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

About Author Mr.Bazz

Hi thanks for dropping by. Please share the content if you think there is someone who will appreciate it.

1 Comment

  1. Moving files to another hosting provider | basri.my 13/05/2014 at 5:36 pm

    […] I will do database backup & restore. More of it here. But how do I transfer the database? After dumping it, I just put it on my old website and start […]


Leave A Comment

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