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
Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.