Display List of Databases in mysql Command Line

MySQL Show List of Databases in command Line

If you want to know how many databases are available on your mySQL server, you can make use of show databases; query.

mysql> show databases;
| Database           |
| information_schema |
| mydb               |
| mysql              |
| performance_schema |
| sys                |
5 rows in set (0.02 sec)

Do note that its show databases and not database, you will get an error if you forget the "s" at the end.

mysql> show database;

ERROR 1064 (42000): You have an error in your SQL syntax; 
check the manual that corresponds to your MySQL server 
version for the right syntax to use near 'database' at line 1
Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap