2

I have installed mysql 5.5 and percona 5.5 in the same machine. I am not able to identify wheather the running db is mysql or percona. IS there is any way to identify the difference.

Bathakarai
  • 121
  • 3

3 Answers3

3

When you connect to MySQL, just run

SELECT SUBSTR(variable_value,1,
LOCATE(' ',variable_value) - 1) DBVersion
FROM information_schema.global_variables
WHERE variable_name='version_comment';

You should get this when you connect to MySQL

mysql> SELECT SUBSTR(variable_value,1,
    -> LOCATE(' ',variable_value) - 1) DBVersion
    -> FROM information_schema.global_variables
    -> WHERE variable_name='version_comment';
+-----------+
| DBVersion |
+-----------+
| MySQL     |
+-----------+
1 row in set (0.00 sec)

mysql>

You should get this when you connect to Percona Server

mysql> SELECT SUBSTR(variable_value,1,
    -> LOCATE(' ',variable_value) - 1) DBVersion
    -> FROM information_schema.global_variables
    -> WHERE variable_name='version_comment';
+-----------+
| DBVersion |
+-----------+
| Percona   |
+-----------+
1 row in set (0.00 sec)

mysql>

CAVEAT

What I suggested works for MySQL 5.1+ and Percona Server 5.1+.

For version 5.0+ of MySQL or Percona Server, you can still get it as follows:

SQL="SHOW GLOBAL VARIABLES LIKE 'version_comment'"
MYSQL_CONN="-uroot -p..."
DB=`mysql ${MYSQL_CONN} --skip-column-names -Ae"${SQL}" | awk '{print $2}'`
echo ${DB}

Give it a Try !!!

RolandoMySQLDBA
  • 16,544
  • 3
  • 48
  • 84
  • 1
    I've modified the above info into this query `SELECT SUBSTR(@@global.version_comment, 1, LOCATE(' ', @@global.version_comment) - 1) AS DBVersion` – mikeytown2 Feb 20 '15 at 21:33
  • This fails if performance schema is not enabled. See [the following](https://dba.stackexchange.com/a/125178/112701) for more info. – mopsyd Oct 04 '18 at 18:13
2

Run the following command

mysqladmin variables | grep version_comment | awk '{print $2}'
RolandoMySQLDBA
  • 16,544
  • 3
  • 48
  • 84
vdharan
  • 21
  • 1
  • I added the `awk '{print $2}'` to your answer because the second token returned is either `MySQL` or `Percona`. This answer still gets a +1 !!! BTW Welcome to ServerFault. – RolandoMySQLDBA Apr 25 '13 at 14:43
-1

When you login to mysql it will show you what version of Mysql you are running, if you are running Percona Mysql it will show you Percona Mysql version xyz.

  • pls, understand my question. I am not expecting the version. I wants to know the running DB is MySQL or Percona.. – Bathakarai Apr 24 '13 at 11:34