login to local database

mysql -u username -p; # connect to MySQL-Server@localhost, it will ask you for password

login to a remote database

mysql -u username -h your-server.de -p; # connect to a remote MySQL-Server@your-server.de, it will ask you for password

list all databases

login to database first then issue command:

mysql> show databases;
+----------------------+
| Database             |
+----------------------+
| information_schema   |
| xxxxerr_db2          |
| xxxxlaunch           |
| xxxxautomation       |
| xxxxry_datagrid_test |
| mysql                |
| phpmyadmin           |
+----------------------+
7 rows in set (0.00 sec)

file size database size

simply run this sql command:

SELECT table_schema "DB Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM   information_schema.tables 
GROUP  BY table_schema;

# result
+--------------------+---------------+
| DB Name            | DB Size in MB |
+--------------------+---------------+
| test               |           1.4 |
| information_schema |           0.0 |
+--------------------+---------------+
2 rows in set (0.01 sec)

admin