How to list MySQL databases through command line ?

How to list MySQL databases through command line ?

To list MySQL databases you have to login as root user. You can use mysql command to list all available databases. MySQL is simple command line tool which is simple and easy in use.

First, you have to login into the MySQL server through this command line ;
-----
# mysql -u root -p *****
-----

here, -u option is for username and -p option is for password.

Now, you can open MySQL prompt through :
-----
# mysql>
-----

To list all databases availabele run this command :
-----
# SHOW DATABASES;
-----

Result will be similar to this :
-----
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| wiki |
| test |
+--------------------+
4 rows in set (0.00 sec)

-----
Author
bhawanisingh
Views
2,234
First release
Last update
Rating
0.00 star(s) 0 ratings
Top