Have you ever encountered this situation with wood? Does the computer or server need to reload the system? What if you have more than one database on your computer with more than n websites? Copy the database folder, reload the system and then cuff it back? If you use the InnoDB engine, I'm afraid that would be a hassle, one to go out of the database? Oh, my God, what year and month is that going to take? Hefei website Production today, Xiangyang connected to introduce how to export all the database, and then restore the database back, in fact, the use of mysqldump-all-databases parameters can be a breath of your database root user all the database under the breath export to a SQL file. Then, after reloading the system, use the source command to rewind back in a breath.
Export all databases Mysqldump-uroot-p--all-databases > Sqlfile.sql
This will lead to all databases under the root user of the database server. If you are prompted after enter Password: Please enter your MySQL root password.
Note: All is preceded by two minus sign (-), and databases is preceded by a minus sign--all-databases
Like that, it will generate a sqlfile.sql file in my D drive, no cursor flashes during the export process, and when you find that you can type a command (with the cursor flashing), the database is exported.
Roar, it's not small.
Import:
1. Login Mysal:
Mysql–uroot–p
Enter the password as prompted
And then:
Sourced:\sqlfile.sql;
Remember, there's a semicolon behind this sentence.
Linux under the path separator is "/", under Windows is "\" and "/" line
Log in to the local MySQL server directly with Mysql-uroot-p can also, here I write mysql-hlocalhost-uroot-p is actually specified the server is local, access to the remote server needs to specify the host address after the-h parameter
Exit MySQL:
Quit and then enter, see Bye (good-bye meaning) on the successful exit.
In addition, the source command can import more than one SQL file at a time, and the following methods are described below:
1. Create a new All.sql, enter the following content and save:
Sourced:\sql1.sql
Sourced:\sql2.sql
2. After logging in to MySQL, enter the command source All.sql;
The above is done using the command line mode of MySQL, not the operation method of phpMyAdmin and other graphical interface tools.
Source: Hefei Xiangyang Internet Culture Media Co., Ltd.
Http://www.xyservice.com
Respect the copyright of the author, reproduced please indicate the source, thank you!
Mysql One-time backup export/import restore all databases