Site icon David Yin's Blog

Large mySQL database transferring

To transfer the the large mySQL database, you need to learn how to use command to do it.
Large, means the database is bigger than 8 MB after compressing.
phpmyadmin, is a wonderful web tool for mySQL. But the limitation of upload is 8 MB. If the backup file is larger than it, you can not upload it, of course can not import it.
The platform I am working is Linux, Centos. It is ssh command environment.
1) Backup, export all tables of one database into one file.

mysqldump -u root -p databasename | gzip > backup.sql.tar.gz

I use this command to backup my forum database. The result is gzip file, means after compressing. I have a database is above 500MB. The gz file is about 125MB.
When I have the gz file, I can download it to my PC, or put it on other server for transferring.


2) Import into mySQL server

mysql -u root -p databasename < backup.sql.tar.gz

or

mysql -u root -p databasename < backup.sql

By these command, you can import, export, dump any size of MySQL database.

Exit mobile version