Ssh – How to use SSH import database into thesql

databaseMySQLssh

I have a bigger database(2.1GB). I want input it into mysql in server part. If I output it from mysql in local part with tar.gz format, it has 420MB, if left a sql format, it has 2.1GB.

How to use SSH import database into mysql? some method here support sql format only:

# mysql -u username -p database_name < file.sql

transfer a 420MB tar.gz to server part, than do a unziped?(maybe a long time during unzipped) cut sql to many pieces? Or better idea?

Another question, should I modify the my.cnf to support a large size file input?

Regards.

Best Answer

Yes, if you have disk space, transfer the compressed file to the server, uncompress there, and then import.

There's no obvious need to cut the file into smaller pieces. It's not like you're posting to Usenet.

If your connection is slow, you can use "rsync", which can resume interrupted transfers, e.g., rsync file.sql.gz server:/tmp/file.sql.gz