↑ ↓ select, Enter open, Esc close

Show the size of all databases in MB

root@server
mysql -e '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;'

Sums up the size of data and indexes per database from information_schema and sorts in descending order. Quickly shows which website or application uses the most database space. The values are InnoDB estimates and may differ from the space used on disk.

Note: On Plesk servers, run it via plesk db or as admin.

Also searched as

  • which database is the largest
  • show mysql database size
  • database disk usage

Related one-liners

All in MySQL and MariaDB

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.