How to show all databases in MySQL?
Syntax
To list all databases on the current MySQL server, we use SHOW DATABASE command. Here is the generic syntax:
SHOW DATABASES [LIKE 'pattern' | WHERE expr];
Because in MySQL, database and schema are synonyms, so you can also use SHOW SCHEMAS command:
SHOW SCHEMAS [LIKE 'pattern' | WHERE expr];
There’s another way to show all databases in MySQL, which is to run the SELECT
query from schemata table in the information_schema database:
SELECT schema_name FROM information_schema.schemata;
Example:
To show all available databases on the current MySQL server:
SHOW DATABASES;
The result is:
Database |
---|
employees |
information_schema |
mysql |
new_db |
performance_schema |
sakila |
tableplus |
sys |
Need a good GUI tool for databases? TablePlus provides a native client that allows you to access and manage Oracle, MySQL, SQL Server, PostgreSQL, and many other databases simultaneously using an intuitive and powerful graphical interface.
Not on Mac? Download TablePlus for Windows.
On Linux? Download TablePlus for Linux
Need a quick edit on the go? Download TablePlus for iOS