Link to home
Start Free TrialLog in
Avatar of el123
el123Flag for United States of America

asked on

MySQL: how to take the backup of the database using mysqldump

Hi, I just want to take the mysql db backup using mysqldump.

Can any help.

Thanks,
EL
Avatar of hielo
hielo
Flag of Wallis and Futuna image

mysqldump db_name > backup-file.sql

http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html
To allow for consistent reads from the database and to control character set issues, I recommend doing it like this:

mysqldump --single-transaction --result-file=db_name.sql db_name --default-character-set=utf8

Reference:
http://dev.mysql.com/doc/refman/5.0/en/backup-policy.html
As 'hielo' mentioned 'mysqldump' is the tool to take mysql database backup.

Also, What kind of tables do you use ? innodb or myisam? if your answer is innodb then don't forget to use --single-transaction option to get a consistent dump.. and if its myisam table then without locking you will not be getting a consistent backup...so make sure its locked before you dump...
Oops.. not refreshed :-)
Avatar of el123

ASKER

thank Gurus, my tables are all Innodb, and I want script too, so I can automate them to be taken on certain schedules
ASKER CERTIFIED SOLUTION
Avatar of Umesh
Umesh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Did you check this?