MySQL Export From Remote Server Through Terminal – Ubuntu

mysqldump from remote server

 mysqldump -P3306  -h192.168.20.151 -uroot -p database > /home/manager/Downloads/my.sql

mysqldump specfic table from remote server

 mysqldump -P3306  -h192.168.20.151 -uroot -p database tablename > /home/manager/Downloads/my.sql

mysqldump multiple tables from remote server

 mysqldump -P3306  -h192.168.20.151 -uroot -p database tablename1 tablename2 tablename3 > /home/manager/Downloads/my.sql
Advertisements

Check MySQL Database & Tables Size

Check Single Database Size in MySQL:

SELECT table_schema "Database Name", SUM( data_length + index_length)/1024/1024"Database Size (MB)" FROM information_schema.TABLES where table_schema = 'mydb';

Check ALL Database Size in MySQL:

SELECT table_schema "Database Name", SUM(data_length+index_length)/1024/1024
"Database Size (MB)"  FROM information_schema.TABLES GROUP BY table_schema;

Check Single Table Size in MySQL Database:

SELECT table_name "Table Name", table_rows "Rows Count", round(((data_length + index_length)/1024/1024),2)
"Table Size (MB)" FROM information_schema.TABLES WHERE table_schema = "mydb" AND table_name ="table_one";

Check All Table Size in MySQL Database:

SELECT table_name "Table Name", table_rows "Rows Count", round(((data_length + index_length)/1024/1024),2)
"Table Size (MB)" FROM information_schema.TABLES WHERE table_schema = "mydb";