Mysql database backup and restoration command Linux as 5.5 MySQL 5.0 database backup and recovery:
1. use the mysqldump command for backup:
In the Command prompt window (note that it is not the MySQL Command Line Client window of MySQL), enter,
Mysqldump-hlocalhost-uroot-proot temp> temp_2011. SQL
Mysqldump-hlocalhost-u root-proot temp> temp_2011. SQL
Mysqldump-h localhost-u root-proot temp> temp_2011. SQL
First, go to the directory where MySQL wants to store the backup file (which is easy to store the generated *. SQL file ).
You can also specify the directory to be stored in the command: for example, to store it in the root directory, the command is as follows:
Mysqldump-h localhost-u root-proot temp> temp_2011. SQL>/2011. SQL
The-h and-u parameter names and parameter values can be separated by or without spaces,
However, The-p parameter must not contain spaces between the parameter name and the parameter value. you can also enter the following:
Mysqldump-hlocalhost-uroot-p temp> temp_2011. SQL
Enter password: root
You can also enter the password later.
-H indicates that the backup database is on the local machine,-u indicates the user name,-p indicates the password, temp indicates the database name, and the backup data table can be specified later.
The generated temp_2011. SQL file automatically exists in the specified directory.
2. use the mysql command to restore:
Mysql-hlocalhost-uroot-proot temp <temp_20071106. SQL
After you enter this command, the data in the database will be restored to the backup data.
Note: During recovery, temp must exist, and the database can be empty. during recovery, the table to be restored will be automatically deleted, re-created, and inserted data.