Use mysqldump database backup

First, enter the directory mysqldump.exe at the command prompt (if mysqldump.exe directory has been added to the system path environment variable, this step can be omitted)

备份
mysqldump.exe --opt --add-drop-database --add-drop-table -hlocalhost -uroot -p123456 --result-file=d:/bak.sql --default-character-set=utf8 dbname

备份指定表
mysqldump.exe --opt --add-drop-database --add-drop-table -hlocalhost -uroot -p123456 --result-file=d:/bak.sql --default-character-set=utf8 dbname tab1 tab2 tab3...

还原
mysql -hlocalhost -uroot -p123456 --default-character-set=utf8 dbname<d:/bak.sql

Guess you like

Origin blog.51cto.com/14549989/2439738