This tutorial shows how you can show the list of databases on MySQL or MariaDB servers using mysql client.
To invoke mysql command-line SQL shell, type:
$ mysql --user=user-name --password=password
To list all databases running on the server, type the following command:
mysql> show databases;
Output:
+--------------------+ | Database | +--------------------+ | information_schema | | techjourny | | mysql | | test | | performance_schema | +--------------------+ 5 rows in set (0.27 sec)
That’s it. It’s so simple. You can use the database you want to perform SQL queries on it.
$ mysql --user=user-name --password=password -e 'show databases;'