determine if mysql or percona or mariaDB
Asked Answered
W

2

14

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.

Whacking answered 19/5, 2016 at 8:30 Comment(0)
T
6

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.)

Tristis answered 27/5, 2016 at 17:1 Comment(5)
So I can assume that Percona & MariaDB always report their names and MySQL is acting differently here?Whacking
My answer is based on empirical evidence. Based on history... MySQL is the base product (now owned by Oracle), so it has no reason to be specific in the settings. The others are spinoffs, so they feel need for such.Tristis
A longer answer: #43611796Tristis
Be warned that this answer is probably outdated. I get version = '10.3.22-MariaDB-0+deb10u1-log', version_commnet = 'Debian 10'. See mariadb.com/docs/reference/mdb/system-variables/version_commentJasik
@Jasik - Thanks. I have updated my answer.Tristis
D
6

You can get specific information with:

SHOW VARIABLES LIKE '%vers%'

version and version_comment are very specific.

Doggerel answered 19/5, 2016 at 8:33 Comment(5)
on my dev server, 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 upWhacking
This might be distribution specific then. On Fedora I see "MySQL Community Server (GPL)" or "MariaDB Server" for the two instances I'm testing with.Doggerel
Seems so, the example from dev.mysql.com/doc/refman/5.7/en/show-variables.html states Source distribution.Whacking
Does Percona have any special variables you can pick out?Doggerel
I don't have access to that server anymore. It was reinstalled. I would expect that the innodb_* variables to be named xtradb_*, but I wouldn't call this a clear answer to my problem.Whacking
T
6

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.)

Tristis answered 27/5, 2016 at 17:1 Comment(5)
So I can assume that Percona & MariaDB always report their names and MySQL is acting differently here?Whacking
My answer is based on empirical evidence. Based on history... MySQL is the base product (now owned by Oracle), so it has no reason to be specific in the settings. The others are spinoffs, so they feel need for such.Tristis
A longer answer: #43611796Tristis
Be warned that this answer is probably outdated. I get version = '10.3.22-MariaDB-0+deb10u1-log', version_commnet = 'Debian 10'. See mariadb.com/docs/reference/mdb/system-variables/version_commentJasik
@Jasik - Thanks. I have updated my answer.Tristis

© 2022 - 2024 — McMap. All rights reserved.