MySQL database backup and restore

1, mysql database backup and restore
* The first one uses a visualization tool for backup and restore

* The second use sql statement for backup and restore
- mysql database backup
-- statement mysqldump -u root -p name of the database to be backed up> location to be backed up to the local disk (no semicolon can be added)
* mysqldump -u root -p day16 > c:\day16.sql

*** Note 1: When executing this statement, you cannot connect to the mysql database and execute this statement directly in the cmd window.

*** Note 2: In the database statement backed up by this statement, there is no statement to create the database.

*** Note 3: The backup file extension must be .sql

*** Note 4: There can be no Chinese in the backup file path.


- Restore of mysql database
-- statement mysql -u root -p name of the database to restore to <path to backup file

* Steps to restore

- Step 1: Create a database to restore
Create database day16;

- Step 2: Open the cmd window, do not log in. Execute mysql -u root -p Name of the database to restore to <Backup file path
Mysql -u root -p day16 < d:/day16.sql
-- Note 1: You cannot write a semicolon after the execution statement

* Note: If you add, modify, delete the database, you must first back up