If you need to backup your database, you can use mysqldump command.
mysqldump -uuser -ppassword database_name > backup.sql
If you need to dump a single table, you can do the following:
mysqldump -uuser -ppassword database_name table_name > backup.sql
This should generate a bunch of Create Table and Insert Sql statements in the .sql files.
So how do you import the database from your sql dump files. Let’s say you have the backup.sql in your computer now. First thing you need to do is upload this dump to the database server. To do this, you can use scp command to copy the files and do a secure file transfer.
scp -rP port_num backup.sql root@server_name:/root/backup
After that you have to go to the mysql command tools by :
mysql -uroot -ppassword database_name
After authenticated, you run the following again to import:
source /root/backup/backup.sql




