Home >Backend Development >PHP Tutorial >What should I do if mysql directly backs up files and the data cannot be restored?
The website I have been running, suddenly one day I found that the website was down. After troubleshooting, it was that the database was down.
Log in to Mysql and it will appear:
<code>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) </code>
If you want to restart Mysql, the following message will appear:
<code>stop:unknown instance start:job failed to start </code>
Because I found that Mysql was down, I couldn't back it up in the normal way, so I thought of directly copying the files under /var/lib/mysql for data backup.
After reinstalling Mysql, I replaced several .frm previously backed up under /var/lib/mysql/dbname/, started Mysql, and found that the previous data backed up was no longer there, but was still newly created. data in the database.
After searching, I learned that innodb has to replace ibdata1, so after I replaced it, I could not successfully start my Mysql, prompt:
<code>start:failed to start </code>
Excuse me, how can I restore my previous data?
The website I have been running, suddenly one day I found that the website was down. After troubleshooting, it was that the database was down.
Log in to Mysql and it will appear:
<code>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) </code>
If you want to restart Mysql, the following message will appear:
<code>stop:unknown instance start:job failed to start </code>
Because I found that Mysql was down, I couldn't back it up in the normal way, so I thought of directly copying the files under /var/lib/mysql for data backup.
After I reinstalled Mysql, I replaced several .frm previously backed up under /var/lib/mysql/dbname/, started Mysql, and found that the previous data backed up was no longer there, but was still newly created. data in the database.
After searching, I learned that innodb has to replace ibdata1, so after I replaced it, I could not successfully start my Mysql, prompt:
<code>start:failed to start </code>
Excuse me, how can I restore my previous data?
Check the specific mysq error log file and solve the problem based on the error information inside