Nasser Heidari

2008-06-09

Mysql Database Backup and Restore

Filed under: Linux — Nasser Heidari @ 11:00

Backup

mysqldump –add-drop-table –default-character-set=utf8 -r <output-file> -u <username> -p<password> <database>

example :

mysqldump –add-drop-table -r backup20060609.sql -u root -p123 mydatabase

mysqldump –add-drop-table –default-character-set=utf8 -u root -p123 mydatabase | gzip > backup20060609.sql.gz

Restore

mysql –default-character-set=utf8 -p<password> -u <username> -D <database> < <input-file>

example:

mysql -p123 -u root -D mydatabase < backup20060609.sql

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: