Using Command List All Databases in MySQL on the Server

In this article, we show you how to list all databases in MySQL using a command on the server. Commonly you know that MySQL is an open source relational database management system. Most of the web applications are using MySQL database e.g. Core PHP Applications, WordPress, Magento, etc.

If you like to list all your database for that you need access to run the command as root or via the sudo in your Linux server. Once you connected the server with SSH use the following steps to get the database and table names.

If you like to create a database backup using SSH. Here you have an article.

Mysql Databases List


mysql

Output:


mysql>

You may be required to provide MySQL hostname, username, and password to use.


$ mysql --user=user_name --password=password

Example:


mysql --user=root --password=HelloSoftaox

To list Database


mysql> show databases;

Output:


mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mraj_wp            |
| divine_con         |
| dig_wp2            |
| artwork_wp         |
+--------------------+
5 rows in set (0.00 sec)

If you want to use a particular database and you like to list all the tables in it use the following command to the list.


mysql> use mysql;

To list the tables use the following command.


mysql> show tables;

Output:


mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| my_priv                   |
| live_files                |
| admin_conte               |
| commands_list             |
| theme_funcation           |
| wp_commentmeta            |
| wp_comments               |
| wp_links                  |
| wp_options                |
| wp_postmeta               |
| wp_posts                  |
| wp_terms                  |
| wp_termmeta               |
| wp_term_relationships     |
| wp_term_taxonomy          |
| wp_usermeta               |
| wp_users                  |
+---------------------------+
17 rows in set (0.00 sec)

Was this article helpful?

Yes No
×

How can we improve it?

×

We appreciate your helpul feedback!

Your answer will be used to improve our content. The more feedback you give us, the better our pages can be.

Follow us on social media:

Facebook Pinterest
Share via:

Mraj

Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts.

Leave a Reply