Generally, MySql database backup can be performed in two ways: Exporting SQL statements directly or SQL storage files in other formats that are easy to import, and using SQL statements or some visual clients to export data. This method is very simple.
Generally, MySql database backup can be performed in two ways: Exporting SQL statements directly or SQL storage files in other formats that are easy to import, and using SQL statements or some visual clients to export data. This method is very simple.
Generally, MySql database backup can be performed in two ways: Export SQL statements directly or export SQL storage files in other formats that are easy to import. The Hong Kong server is rented, you can use SQL statements or some visual clients to export data. This method is very simple and does not need to be described in detail. Another method is to copy the database file and convert the database file into an SQL file, Vm, this article introduces this method for Hong Kong virtual hosts.
① Find the location where the database files are stored. The suffixes of MySql files include *. MYD, *. MYI, and *. frm;
② Enter the database storage file directory;
Cd/opt/lan mp/mysql-5.1.63/win/data/
③ Use the copy command to copy all the data;
Copy mysql/home
④ At this time, you only need to convert these database files into SQL files, which is also the focus of this Article. If you need to import the SQL files with commands, you can;
⑤ Create a new database named mysqlbak and paste the copied folder into the data folder of the new database;
Cd/home/mysql
Copy */www/wdlinux/mysql-5.1.63/var/mysqlbak/
⑥ Now we can see the data in the new database mysqlbak, which is the same as the data in the original database mysql;
7. Use commands to export database files.
Mysqldump-uroot-p mysqlbak>/home/mysql. SQL
The mysql. SQL file in the home folder is a database file that is easy to import. Note that all operations must be completed using commands in the operating system, rather than using tools. In actual operation, we often encounter the inconsistency between the database file version and the database version, or the inconsistency between the new and old database versions, in addition, unexpected problems such as incompatibility between the data server version and client tools may occur. If this is the case, "1577: cannot proceed because system tables used by Event sched1_were found damaged at server start "error. Speaking of this, in fact, this article also provides a method to open mysql database files, if there are only a bunch *. MYD ,*. MYI ,*. in the frm file, perform Step 5 to Step 5.
This article is from the "Rainbow cat walking across the world" blog!