≡ Menu

MySQL List Databases

Q. How do I display a list of all databases under MySQL Server?

A. Use show databases sql command. First you need to login as mysql database root user using mysql command line client. Type the following command to login with a password at a shell prompt:

$ mysql -u root -p
At mysql prompt type the following command:
mysql> show databases;
Sample output:

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| wiki               |
+--------------------+
3 rows in set (0.03 sec)
Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 4 comments… add one }

  • Ramanan July 4, 2008, 7:04 pm

    for me some of the databases are not listing wven though complete privilleges are given and i checked same on mysql.db table also .Please help me out

  • budacsik September 20, 2008, 2:50 pm

    from script

    mysql -u username -pxxxxxx -Bse ‘show databases’

  • seafangs February 7, 2012, 4:26 pm

    thanks :)

  • deepak August 4, 2015, 11:29 am

    Task: Develop a PHPMyAdmin Input: Hostname, Username, Password.
    Output: List all databases & table names which are associated with the given username & password.please guys,can anyone tell me how to do it?thanks in advance

Leave a Comment