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.

Steps to list databases in MySQL or MariaDB:

  1. Open a terminal session that can reach the database server.
  2. List the databases visible to the current account with the mysql or mariadb client.
    $ 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.

  3. Filter database names with LIKE when you need only a prefix or pattern match.
    $ 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.

  4. Exclude common system schemas with a WHERE clause when you need only application databases.
    $ 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.

  5. Check whether one exact database name is present before using it in scripts or application settings.
    $ 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.

  6. Optionally use mysqlshow or mariadb-show when you only need a quick inventory and do not need SQL filtering.
    $ 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.