Backing up your MySQL Database
Performing regular backups of your MySQL database server is important. You never know when a server could crash and all your information could be lost. In this tutorial we will show you the basics of backing up and restoring your database using mysqldump and phpMyAdmin.
Backing up your MySQL Databases
The following command will dump all databases to an sql file. Replace pass with your root database password and filename with the name of the file you wish to create such as backup.sql
# mysqldump -u<user> -p<pass> -B --all-databases > <filename> # mysqldump -uroot -pSuperPass -B --all-databases > all.sql
A single database can be backed up also.
# mysqldump -u<user> -p<pass> <database> > <filename> # mysqldump -uWiki -pBlue wikidb > wikidb.sql
Mysqldump is located at /usr/local/bin/mysqldump
Compressing the backup
The file can then be compressed to reduce its size and make it easier to move around with the following.
# bzip2 --best <filename>
Comments
No Comments Yet.
Ask a question or add a comment here.