1. Backup
# Export Database: Mysqldump-u username-P database name > exported file name
Mysqldump-–add-drop-table-uusername-ppassword databasename > Backupfile.sql
Note: 1, enter the password, enter the password of the database user name
2. If you export a single table, enter the table name after the database name.
3, if prompt locktable error: Then mysqldump-uroot-p ABC after empty a grid plus--skip-lock-tables
2, restore
Mysql-uroot-p Lefuyun_lrs < Lefuyun_20170326-001001.sql
If you restore, you are prompted with the following error:
ERROR at line 861:unknown command ' \ n '.
Before the character set of MySQL is GBK, the database is also GBK, but the backup is mysqldump, check the network said this statement backup default is UTF8.
Default-character-set=utf8 is also added to the recovery statement to resolve
Mysql-uroot-p--default-character-set=utf8 Lefuyun < C:\lefuyun_20171119-001001.sql
3. Execute SQL file
Mysql–u User name –p password –d database < "SQL script file path full name"
mysql–uroot–p123456-dtest<ss.sql;
MySQL database backup and recovery