What can I do if Mysql cannot restore data because of direct backup of files? -Php Tutorial

Source: Internet
Author: User
Background my website was running all the time. suddenly, one day I found that my website was suspended. After troubleshooting, my database crashed. Login to Mysql: {code ...} to restart Mysql, the following error occurs: {code ...} because I found that Mysql has crashed, so I cannot back up data normally, so I thought of directly copying var... background

My website was running all the time. suddenly one day I found that my website had crashed. After troubleshooting, my database had crashed.
Login to Mysql:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

To restart Mysql, the following error occurs:

stop:unknown instancestart:job failed to start

I found that Mysql has crashed, so I cannot back up data normally. I thought of directly copying files under/var/lib/mysql for data backup.

Question

After I reinstall Mysql, I replaced the previous backups under/var/lib/mysql/dbname. after frm, start Mysql and find that the backup data is not in use, or the data in the newly created database.
After searching, I learned that innodb has to replace ibdata1, so after I replace it, I cannot start my Mysql. the prompt is:

start:failed to start

How can I restore my previous data?

Reply content: Background

My website was running all the time. suddenly one day I found that my website had crashed. After troubleshooting, my database had crashed.
Login to Mysql:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

To restart Mysql, the following error occurs:

stop:unknown instancestart:job failed to start

I found that Mysql has crashed, so I cannot back up data normally. I thought of directly copying files under/var/lib/mysql for data backup.

Question

After I reinstall Mysql, I replaced the previous backups under/var/lib/mysql/dbname. after frm, start Mysql and find that the backup data is not in use, or the data in the newly created database.
After searching, I learned that innodb has to replace ibdata1, so after I replace it, I cannot start my Mysql. the prompt is:

start:failed to start

How can I restore my previous data?

View the specific mysq error log file and solve the problem based on the error information.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.