In Windows, I used the Navicat for mysql tool at the beginning to use the export/import database function in MySQL. However, some tables were lost after the export; so I thought of the command line.
The following is a command line backup and restoration method:
Set MySQL to disk c. the mysql database username is root, the password is 123, and the database name is db_name. store the backup database under the root directory of disk D. The backup database name is backup20110527. SQL.
Back up the database:
Mysqldump-uroot-p123 db_name> d:/backup20110527. SQL
Restore database:
Delete the original database, create a database, and import the backup database.
Mysqladmin-uroot-p123 drop db_name
Mysqladmin-uroot-p123 create db_name
Mysql-uroot-p123 db_name
Note: before importing the backup database, if db_name does not exist, you need to create it. Besides, the database name in backup20110527. SQL is the same.