Backing up and restoring MySQL databases

To back up MySQL, log on as the root user and run:

mysqldump –opt -u user -p dbname > {path}/backup.sql

To restore the database run:

mysql -u user -p dbname < {path}/backup.sql