Howto: Backup and Restore a database

Posted by admin     Category: Mysql & PostGres SQL

You need to use the “mysqldump” command to backup a Mysql database.

Backup/Dump a Mysql database on a Linux Or Linux/cPanel server:

root@host [~]# mysqldump /var/lib/mysql/dbname > dbname.sql

Restore the .sql file in a database:

root@host [~]# mysql /var/lib/mysql/dbname < /path/to/filename.sql

Backup/Dump a Mysql database on a Linux/Plesk server:

root@host [~]# mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` /var/lib/mysql/dbname > dbname.sql

Restore the .sql file on a Plesk server :

root@host [~]# mysql -uadmin -p`cat /etc/psa/.psa.shadow` /var/lib/mysql/dbname < /path/to/filename.sql

Tags: , , ,

2 Responses to “Howto: Backup and Restore a database”

  1. Vercher Says:

    nice post..

  2. Inge Ziller Says:

    Have you ever thought of adding additional videos to your site to keep the viewers more engaged? I just read through the entire article and it was quite good but since I learn visually, I find videos to be very helpful. I enjoy what you guys are always coming up with. Keep up the nice work. I will check out your site regularly for some of the latest post.

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image