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)

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin