Solutions to several problems in MySQL recovery, mysql issues
This is the case: I have a vps of the BuyVM. As a result, my machine crashes and a new one is opened for me. I asked to export the backup to me. Most of the data is actually saved. then there is a recovery process. web restoration is not difficult. the problem lies in the restoration of MySQL.
1. The data directory is complete, but no table can be read. show tables is blank.
First, I suspected that there was a problem with the data directory and tried to fix the problem. The system prompts that there is no table. The system prompts me if there is a problem with the user group. Specify the user group as mysql to solve the problem.
Copy codeThe Code is as follows:
Chown-R mysql/var/lib/mysql
2. fix the problem.
Copy codeThe Code is as follows:
Warning: Table is marked as crashed and last repair failed
Warning: 1 client is using or hasn' t closed the table properly
Warning: Size of datafile is: 32453700 shoshould be: 32376944
Error: Wrong bytesec: 0-0-0 at linkstart: 32453660
According to the prompt, It is the data file owner problem. It turns out that it is root. Give it mysql and solve it.
Copy codeThe Code is as follows:
Chown-R mysql. mysql/var/lib/mysql
3. After the repair is completed, a table Error is prompted: Incorrect information in file: './aaa/bbb. frm '.
Failed to try various repair methods. Google found that. frm only stores the table structure. Table structure? Try overwriting the file with the same table structure. Delete bbb. frm, copy the ccc. frm in a database, and change it to bbb. frm!
In a word, multiple backups are king, and mysql always encounters various problems in disk transfer.