Listing databases in MySQL or MariaDB confirms which schemas are visible to the account in use before restoring a dump, granting access, or pointing an application at the correct database. A quick inventory also helps separate production, staging, archive, and test schemas on servers that host more than one workload.
In current official documentation, SHOW DATABASES and SHOW SCHEMAS remain equivalent SQL statements, and both products still support optional LIKE and WHERE filtering inside the SQL client. The mysqlshow and mariadb-show utilities still provide a quick command-line inventory, but they return the same privilege-scoped database list rather than bypassing server permissions.
Current MariaDB packages usually ship the mariadb and mariadb-show client names, while MySQL systems typically keep mysql and mysqlshow. Remote connections still depend on the correct host, port, TLS, and authentication method, and a server started with --skip-show-database limits the statement to accounts that hold the global SHOW DATABASES privilege.
$ mysql --host=db.example.net --port=3306 --user=dbadmin --table --execute "SHOW DATABASES;" +--------------------+ | Database | +--------------------+ | app | | appdb | | information_schema | | mysql | | performance_schema | | reporting | | sys | +--------------------+
Add --password when the account requires interactive authentication, but avoid --password=secret because credentials can leak through process listings and shell history.
On current MariaDB systems, replace mysql with mariadb. The same statement also works as SHOW SCHEMAS;, and the result always stays privilege-scoped. A limited account may see only its own application schema plus information_schema.
$ mysql --host=db.example.net --port=3306 --user=dbadmin --table --execute "SHOW DATABASES LIKE 'app%';" +-----------------+ | Database (app%) | +-----------------+ | app | | appdb | +-----------------+
In LIKE patterns, '%' matches any length and '_' matches a single character.
$ mysql --host=db.example.net --port=3306 --user=dbadmin --table --execute "SHOW DATABASES WHERE `Database` NOT IN ('information_schema','mysql','performance_schema','sys');"
+-----------+
| Database |
+-----------+
| app |
| appdb |
| reporting |
+-----------+
Keep sys in the exclusion list when it exists on the server. If the instance does not include that schema, leaving it in NOT IN (...) does no harm.
$ mysql --host=db.example.net --port=3306 --user=dbadmin --table --execute "SHOW DATABASES LIKE 'reporting';" +----------------------+ | Database (reporting) | +----------------------+ | reporting | +----------------------+
An empty result usually means the schema name is absent or the account cannot see it.
$ mysqlshow --host=db.example.net --port=3306 --user=dbadmin +--------------------+ | Databases | +--------------------+ | app | | appdb | | information_schema | | mysql | | performance_schema | | reporting | | sys | +--------------------+
Use mariadb-show on systems that ship the MariaDB client names. For exact-name checks or LIKE and WHERE filtering, stay with SHOW DATABASES inside the SQL client.