Tuesday, December 8, 2009

back up MYSQL

to back up your databases, you can do the following...

mysqldump -u [username] -p[root_password] [database_name] > dumpfilename.sql

for example I have a database with the following informations...

root username: James
root password: Aves
Database Name: aeisjean

and I want to save the copy as aeisjean.sql

you will do this...

mysqldump -u James -pAves aeisjean > aeisjean.sql

---------

to restore just type
mysql -u [username] -p[root_password] [database_name] < dumpfilename.sql

Note: You can save your backup in your PC... By default, the backup will be on the root folder in your server...