Question

Is there any way to detect whether it's MySQL being used or MariaDB being used? As this would be useful in making MariaDB specific optimizations.

Was it helpful?

Solution

SHOW VARIABLES LIKE "%version%";

This is from Maria DB

version=10.0.7-MariaDB-1~quantal-log

This is from MySQL

version_comment=MySQL Community Server (GPL)

With PDO you can use ATTR_SERVER_VERSION attribute to get server version:

echo $conn->getAttribute(PDO::ATTR_SERVER_VERSION); // output: <major>.<minor>.<build>-MariaDB
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top