CyberX

mobile

How to rename database after Maria DB dump success

There are some ugly solutions for database management like Maria DB thats won't recover your mysql dump correct. For example it will ignore path where you want to write dump and change database randomly.

Fortunately, we have a terminal command to rebase tables:


mysql -uroot -proot misatkeDB -sNe 'show tables' | while read table; 
do mysql -uroot -proot -sNe "RENAME TABLE misatakeDB.$table TO target.$table"; 
done

You have to change user and password and wait for some minutes to accomplish.

How to check MySQL database size

Some times, when we use not standard solutions for database management like Maria DB, we have not any solutions with GUI to see some information such as Data Bases size allocated on drive and we you need to know some special and useful commands.

For example with next code we can see how many size of Data Base are busy on drive.


SELECT table_schema "*", 
ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" 
FROM information_schema.tables 
GROUP BY table_schema;

Code bellow after execution show detail information about Data Bases size.