How can i tell if a server I'm connecting to is Percona or MySQL or MariaDB?
Is there any standard way of doing this?
I'm currently using SHOW VERSION
to test the server version, but I would also need to display the server name in the app I'm working on.
Use phpMyAdmin to find the MySQL database server version. Simply, login to your phpMyAdmin, and on the left side of Dashboard, you will get all key details including the version of MySQL or MariaDB.
If you see anything XTRADB such as XTRADB_READ_VIEW/XTRADB_INTERNAL_HASH_TABLES/XTRADB_RSEG then you know it is Percona Server since they add in XTRADB.
Percona is the premier support provider for open source databases, including MariaDB, the most well-known fork of MySQL.
Keep in mind that "MySQL" is the original, and the others are spinoffs. Here is some code that probably always works:
version_comment REGEXP 'MariaDB' -- > Mariadb
version_comment REGEXP 'Percona' -- > Percona
else MySQL
version_comment
can be accessed via SHOW VARIABLES
or information_schema
.
@@version
is not reliable because Percona leaves no clue, although I suspect the '-30.3-' is a clue in 5.5.31-30.3-log
.
(I checked 106 servers.)
Update
(checking 264 servers.)
version REGEXP 'MariaDB' -- > Mariadb
version_comment REGEXP 'Percona' -- > Percona
else MySQL
(And we probably cannot trust for this to be the final word.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With