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.
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.)
You can get specific information with:
SHOW VARIABLES LIKE '%vers%'
version
and version_comment
are very specific.
version_comment=(Ubuntu)
, version=5.5.47-0ubuntu0.14.04.1
. No trace of "MySQL" string anywhere. I've looked trhough all SHOW VARIABLES
list and nothing relevat came up –
Whacking Source distribution
. –
Whacking 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.)
© 2022 - 2024 — McMap. All rights reserved.