Updated: 13 November 2026 · Applies to: MariaDB 10.6 to 11.4 and MySQL 8, command line

Run SHOW DATABASES; inside the MySQL or MariaDB client to list every database the connected user can see.

Open the client and list databases

mysql -u root -p

On a cPanel server, root can usually connect without typing a password:

mysql

Once connected, run:

SHOW DATABASES;

Output looks like this:

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| shopdb             |
+--------------------+

List databases without opening the client

Pass the whole command on one line:

mysql -u root -p -e "SHOW DATABASES;"

On a server where root logs in without a password this becomes:

mysql -e "SHOW DATABASES;"

A normal (non-root) user only sees the databases they have at least one privilege on: information_schema and their own databases, never the full server list.

More useful queries once you can see the databases

Size of each database, in megabytes, biggest first:

SELECT table_schema AS db, ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) AS mb
FROM information_schema.tables
GROUP BY table_schema
ORDER BY mb DESC;

Tables inside one database:

SHOW TABLES FROM shopdb;

Which user is logged in and which database is selected:

SELECT CURRENT_USER(), DATABASE();

"ERROR 1045 (28000): Access denied"

This means the username or password is wrong for the host you are connecting from, not that the server has no databases. Check that the account was created for the host you are connecting from ('user'@'localhost' is different from 'user'@'%'), and that the password has no stray spaces or shell quoting problems. See fixing MySQL "username not known" errors and creating a MySQL user and granting permissions from the command line.

To list databases through a graphical tool instead, phpMyAdmin shows the same list in its left sidebar; see importing a database in phpMyAdmin and backing up a database with phpMyAdmin.

Official documentation: MariaDB SHOW DATABASES, MySQL SHOW DATABASES.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Managed cPanel VPS

cPanel included; we handle updates, security and monitoring.

Server management

on-demand administration, hardening, migrations and monitoring.

Was this answer helpful?

Still stuck? Open a ticket