MySQL Command to Show a List of Databases 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
1 |
mysql |
Output:
1 |
mysql> |
You may be required to provide MySQL hostname, username, and password to use.
1 |
$ mysql --user=user_name --password=password |
Example:
1 |
mysql --user=root --password=HelloSoftaox |
To list Database
1 |
mysql> show databases; |
Output:
1 2 3 4 5 6 7 8 9 10 11 |
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.
1 |
mysql> use mysql; |
To list the tables use the following command.
1 |
mysql> show tables; |
Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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) |
awsCentOS 7Linux CommandsRedhatserver
Mraj
Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts. If you have any questions let me drop an email with the article name to the following email id: [email protected]