Cómo recuperar la versión actual de una base de datos MySQL?


¿Qué comando devuelve la versión actual de una base de datos MySQL?

 287
Author: Florent Morselli, 2012-01-24

18 answers

Prueba esta función -

SELECT VERSION();
-> '5.7.22-standard'

VERSIÓN()

O para más detalles use:

SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------------------+
| Variable_name           | Value                                    |
+-------------------------+------------------------------------------+
| protocol_version        | 10                                       |
| version                 | 5.0.27-standard                          |
| version_comment         | MySQL Community Edition - Standard (GPL) |
| version_compile_machine | i686                                     |
| version_compile_os      | pc-linux-gnu                             |
+-------------------------+------------------------------------------+
5 rows in set (0.04 sec)

Manual de Referencia de MySQL 5.0 (pdf) - Determinando Su Versión Actual de MySQL-página 42

 492
Author: Devart,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-18 20:06:15

Intenta

mysql --version

, Por ejemplo. O dpkg -l 'mysql-server*'.

 157
Author: Michael Krelin - hacker,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-01-24 13:35:14

Use mysql -V funciona bien para mí en Ubuntu.

 25
Author: Umesh Kaushik,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-17 19:31:52
SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------------------+
| Variable_name           | Value                                    |
+-------------------------+------------------------------------------+
| protocol_version        | 10                                       |
| version                 | 5.0.27-standard                          |
| version_comment         | MySQL Community Edition - Standard (GPL) |
| version_compile_machine | i686                                     |
| version_compile_os      | pc-linux-gnu                             |
+-------------------------+------------------------------------------+
5 rows in set (0.04 sec)

Manual de Referencia de MySQL 5.0 (pdf) - Determinando Su Versión Actual de MySQL-página 42

 15
Author: John Woo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-18 17:37:41

Para UBUNTU puede probar el siguiente comando para verificar la versión de mysql:

mysql --version
 14
Author: Muhammad waqas muneer,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-05 08:49:23

Encontré una manera fácil de conseguirlo.

Ejemplo: Comando Unix(de esta manera no necesita 2 comandos.),

$ mysql -u root -p -e 'SHOW VARIABLES LIKE "%version%";'

Salidas de muestra:

+-------------------------+-------------------------+
| Variable_name           | Value                   |
+-------------------------+-------------------------+
| innodb_version          | 5.5.49                  |
| protocol_version        | 10                      |
| slave_type_conversions  |                         |
| version                 | 5.5.49-0ubuntu0.14.04.1 |
| version_comment         | (Ubuntu)                |
| version_compile_machine | x86_64                  |
| version_compile_os      | debian-linux-gnu        |
+-------------------------+-------------------------+

En el caso anterior, la versión de mysql es 5.5.49.

Por favor, encuentre esta útil referencia.

 14
Author: tk_,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-30 07:18:51
shell> mysql --version

shell> mysql -V
 9
Author: Nanhe Kumar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-01-13 07:20:42

mysqladmin version O mysqladmin -V

 9
Author: Singh Anuj,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-11-01 02:49:19

Desde la consola puedes probar:

mysqladmin version -u USER -p PASSWD
 7
Author: spike,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-08-02 18:04:22

Simplemente inicie sesión en Mysql con

mysql -u root -p

Luego escriba este comando

select @@version;

Esto dará el resultado como,

+-------------------------+
| @@version               |
+-------------------------+
| 5.7.16-0ubuntu0.16.04.1 |
+-------------------------+
1 row in set (0.00 sec)
 5
Author: Nirojan Selvanathan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-12-28 06:13:35

Inicie sesión en su mysql, copie y pegue esto :

SHOW VARIABLES LIKE "%version%";

Salida de muestra:

    mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+---------------------+
| Variable_name           | Value               |
+-------------------------+---------------------+
| protocol_version        | 10                  |
| version                 | 5.1.73              |
| version_comment         | Source distribution |
| version_compile_machine | i386                |
| version_compile_os      | redhat-linux-gnu    |
+-------------------------+---------------------+
5 rows in set (0.00 sec)
 4
Author: Ngo Anh Tuan-HEDSPI,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-07-19 09:36:43

Con CLI en una línea:

mysql --user=root --password=pass --host=localhost db_name --execute='select version()';

O

mysql -uroot -ppass -hlocalhost db_name -e 'select version()';

Devuelve algo como esto:

+-----------+
| version() |
+-----------+
| 5.6.34    |
+-----------+
 3
Author: Nolwennig,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-11 14:39:33

También puedes mirar la parte superior del shell de MySQL cuando inicies sesión por primera vez. En realidad muestra la versión allí.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 67971
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
 2
Author: David Duggins,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-12-23 20:24:58

Probó esto en Ubuntu y otros varian de linux, SELECT @@version y funciona muy bien.

 1
Author: Dariel Pratama,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-11-21 02:55:02
E:\>mysql -u root -p
Enter password: *******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1026
Server version: 5.6.34-log MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select @@version;
+------------+
| @@version  |
+------------+
| 5.6.34-log |
+------------+
1 row in set (0.00 sec)
 1
Author: Abhay Singh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-19 10:16:28

En Windows ,obtenga cmd y escriba MySQL-V o MySQL version version

Si usa Linux get terminal y escribe MySQL-v

 1
Author: teran teshara,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-08-18 15:23:42

Versión del cliente Mysql:

Mysql -version 

Versión del servidor Mysql: Hay muchas maneras de encontrar

  1. SELECT version();

introduzca la descripción de la imagen aquí

  1. SHOW VARIABLES LIKE "%version%";

introduzca la descripción de la imagen aquí

 1
Author: FullStack,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-08-31 09:34:42

Para Mac,

  1. Inicie sesión en el servidor mysql.

  2. Ejecute el siguiente comando:

     SHOW VARIABLES LIKE "%version%";
    
 0
Author: KayV,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-08-09 07:39:27