Backup/restore mysql with command line via SSH

To backup:

mysqldump -u[user] -p [db name] > file.sql

Example: mysqldump -ujoe -p joesdb > file.sql

Notes there is no space between “-u” and “user”.

To restore:

mysql -u [user] -p [db name] < file.sql Example: mysql -u joe -p joesdb < file.sql

Dear fellow Malaysians, if you like the content of this blog and thinking about to support me to continue writing good content, please consider to sign up for Takaful service from me. I am offering life & accidental coverage plans and medical card too. Kindly message me using the PM box on the sidebar (under profile picture). Thanks ;)

One thought on “Backup/restore mysql with command line via SSH

Leave a Reply

Your email address will not be published. Required fields are marked *