MySQL List Databases

by Vivek Gite on April 12, 2008 · 3 comments

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)

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 3 comments… read them below or add one }

1 Ramanan July 4, 2008

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

Reply

2 budacsik September 20, 2008

from script

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

Reply

3 seafangs February 7, 2012

thanks :)

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 14 + 10 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: