Create a backup file typically contains statements and insert statements, mysql command can be executed create statements and insert statements in the backup file;
To create the database and create tables by statements to insert the data backed up by the insert statement.
Syntax: mysql -u root -p [dbname] <backup.sql
dbname: parameter represents the database name. Is an optional parameter to specify the database name, you can not specify.
When specifying the name of the database, the database indicates restore table below; is not specified, it indicates a reduction of a particular database. Have created a backup file statements to the database.
Comments:
Difference: The backup command is mysqldump, reduction using a mysql.
=====================================================
Backup see inside cr01 and employee table:
mysqldump -u root -p123 see cr01 employee > C:\Users\del\Desktop\see.sql
Delete database tables inside cr01 and employee ------>
Restore the backup:
mysql -u root -p123 see < C:\Users\del\Desktop\all.sql
It found that the recovery is complete.
=======================================================================================================
See database backup
mysqldump -u root -p123 --databases see > C:\Users\del\Desktop\seedb.sql
Delete Database see -------->
Perform the recovery statement: database name is not specified here, because there are backup files to create a database statement
mysql -u root -p123 < C:\Users\del\Desktop\seedb.sql
See restored database found
Note: If the backup is a table, you need to specify which database to restore.
If the backup of the database, you do not need to specify the database, the database front and do not take any names, because the backup files there to create a database statement.
With the specified database name error.
====================================================================================================
If all the databases are backed up:
mysqldump -u root -p123 --all-databases > C:\Users\del\Desktop\all.sql
Restore command is as follows:
mysql -u root -p123 < C:\Users\del\Desktop\all.sql