When administering MySQL
database servers, one of the most common tasks you’ll have to do is to
get familiar with the environment. This involves tasks such as listing
databases that reside on the server, displaying the tables of a
particular database or getting information about user accounts and their
privileges.It explains how to show all databases in a MySQL or MariaDB server through the command line.
Show MySQL Databases
The most common way to get a list of the MySQL databases is by using the mysql client to connect to the MySQL server and run the SHOW DATABASES command.
Access the MySQL server using the following command and enter your MySQL user password when prompted:
The most common way to get a list of the MySQL databases is by using the mysql client to connect to the MySQL server and run the SHOW DATABASES command.
Access the MySQL server using the following command and enter your MySQL user password when prompted:
sudo mysql -u root -p (Provide mysql root password)
If you haven’t set a password for your MySQL user you can omit the
-p
switch.
mysql> show databases;
OR
mysql> show schemas;
The command will print a list of all the databases for which the user have some kind of a privilege granted to. The output will be similar to this:
Output
+--------------------+
| Database |
+--------------------+
| information_schema |
| drupal |
| koha_library |
| mysql |
| performance_schema |
| sys |
+--------------------+
6 rows in set (0.20 sec)
| Database |
+--------------------+
| information_schema |
| drupal |
| koha_library |
| mysql |
| performance_schema |
| sys |
+--------------------+
6 rows in set (0.20 sec)
ReplyDeletenice information .thank you.
learn mysql tutorial