Home > Database > Mysql Tutorial > Get a list of MySQL databases and versions?

Get a list of MySQL databases and versions?

王林
Release: 2023-08-30 23:13:02
forward
1413 people have browsed it

获取 MySQL 数据库和版本的列表?

To get the MySQL database list, following is the syntax -

show databases;
Copy after login

To get the server version, you can use the following syntax -

select version();
Copy after login

Let’s implement it The above syntax to get the list of MySQL databases and versions -

mysql> show databases;
Copy after login

This will produce the following output showing all the databases -

+---------------------------+
| Database                  |
+---------------------------+
| bothinnodbandmyisam       |
| business                  |
| commandline               |
| customer-tracker          |
| customer_tracker_database |
| customertracker           |
| database1                 |
| databasesample            |
| demo                      |
| education                 |
| hb_student_tracker        |
| hello                     |
| information_schema        |
| instant_app               |
| javadatabase2             |
| javasampledatabase        |
| login                     |
| mybusiness                |
| mydatabase                |
| mysql                     |
| onetomanyrelationship     |
| onlinebookstore           |
| performance_schema        |
| rdb                       |
| sample                    |
| sampledatabase            |
| schemasample              |
| slotgame                  |
| sys                       |
| test                      |
| test3                     |
| tracker                   |
| universitydatabase        |
| web                       |
| web_tracker               |
| webtracker                |
+---------------------------+
36 rows in set (0.00 sec)
Copy after login

Here is the query to get the versions -

mysql> select version();
Copy after login

This will produce the following output -

+-----------+
| version() |
+-----------+
| 8.0.12    |
+-----------+
1 row in set (0.00 sec)
Copy after login

The above is the detailed content of Get a list of MySQL databases and versions?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template