Check db size
Check mysql
SELECT table_name AS "Table", ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)" FROM information_schema.TABLES WHERE table_schema = "DB_name" ORDER BY (data_length + index_length) DESC;
Check mysql
SELECT table_name AS "Table", ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)" FROM information_schema.TABLES WHERE table_schema = "DB_name" ORDER BY (data_length + index_length) DESC;
Show logged userSELECT USER(),CURRENT_USER();
Show all mysql database usersSELECT User FROM mysql.user;
Show user with pass and hostselect user, password, host from mysql.user;
create a use with read-only rightssudo useradd -r -s /bin/false USERNAME
create this user in dbgrant select on database_name.* to 'USERNAME'@'%' identified by 'password';
Log into mysql server and run
mytop
this command will clean cache tablesdrush cc all
this command do an actual database backupdrush sql-dump > /path/to/filename.sql
MySQL
- database involed
backupmysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql]
or better solutions when data lock error mysqldump --single-transaction