Updated: 28 September 2026 · Applies to: MariaDB 10.6 to 11.4 and MySQL 8

Show the databases on a MySQL/MariaDB server from the command line.

Steps

mysql -u root -p          # or just "mysql" as root on cPanel servers
SHOW DATABASES;

Or in one command, without opening the client:

mysql -e "SHOW DATABASES;"

More useful queries

-- size of each database in MB
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 in one database
SHOW TABLES FROM shopdb;

A normal user only sees the databases they have privileges on.

Ucartz services for this topic

Was this answer helpful? 0 Users Found This Useful (0 Votes)