Home >Backend Development >PHP Tutorial >What should I do if mysql directly backs up files and the data cannot be restored?

What should I do if mysql directly backs up files and the data cannot be restored?

WBOY
WBOYOriginal
2016-07-06 13:52:13910browse

Background

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.

Main topic

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?

Reply content:

Background

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.

Main topic

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php regular matchingNext article:php regular matching