After the database is damaged, the data is complete. how can we restore the data? 1. to avoid problems with the database configuration file, we recommend that you back up the database configuration file every time you modify the database configuration file, in this way, it will be much easier to restore the database, otherwise it will be difficult to solve such problems, but this problem must also be solved, because although the data is local, but do not want to lose the data
Issue description:
1. the problem of testing the database performance in the VM. after modification, we found that the MySQL configuration file was suddenly cleared. After MySQL turned off the service, we found that the local MySQL service could not be started.
2) in addition: after the local database service is stopped, it is found that the MySQL service of the virtual machine cannot be started. Therefore, the virtual opportunity to read the local MySQL service and operate on the virtual machine will also affect the local database service.
3. worker has another MySQL service locally. he wants to switch the existing data to the data directory of this service. However, after changing the service, he can read the database and table, but cannot open the table, the error message is that the table does not exist.
Issue 3 resolve issues
1. steps for solving the problem are shown in figure
2. solution reference: when I was reading database knowledge, I learned that database backup such as Facebook is a direct backup of data files to alleviate the performance impact of mysqldump backup, at the same time, the data files can be directly used for recovery. Therefore, this scheme has been tested many times, and the results are finally obtained through tests last Friday and this week.
Issue 4 when the problem is resolved
1. solve this problem and create a new method for database backup.
2. the current database backup is a backup of the mysqldump command. it can be applied when the database is relatively small. However, when the data volume is large, the backup time will be long, it may be 24 hours or more. This backup will affect the database performance and throughput, making the website slow. the direct backup of these data files will be much faster and will not affect the database query performance. so this method can be used.
3. you only need to copy the folder and ibdata file of each library name.
4. you can copy the folder to the specified address directly after restoring the folder and try again.
We recommend that you install the database in accordance with the last installation and configuration, so that data will not be lost.
We also recommend that you have a document to describe how to install the database and configure the database. the two installations and configurations are based on the original database document.