MySQL database InnoDB engine server power-off data recovery method, mysqlinnodb

Source: Internet
Author: User

MySQL database InnoDB engine server power-off data recovery method, mysqlinnodb

Note:

An online MySQL database server suddenly loses power, causing system failure to start up. After you reinstall the system, find the previous MySQL database folder.

Problem:

By copying files to restore the previous MySQL database, we found that the table in the database could not be found during Program Calling, resulting in the website being inaccessible.

Analysis:

1. MySQL database, which uses the copy file method to restore the database, only supports the MyISAM engine;
2. If a database or data table uses the InnoDB engine, it must be copied together with the ibdata1 file in the MySQL database directory during restoration.

Solution:

1. Stop the MySQL Service

Service mysqld stop

2. Find the backup database file

Cd/home/mysql_bak/mysql/# enter the MySQL Backup Directory

Ibdata1 # This file is required

3. Copy the ibdata1 file to the corresponding database directory.

Cp/home/mysql_bak/mysql/ibdata1/usr/local/mysql/data/ibdata1 # copy the file to the current database directory
Chown mysql. mysql/usr/local/mysql/data/ibdata1 # Set the permission limit for mysql users and user groups
Rm/usr/local/mysql/data/ib_logfile0 # Delete existing log files; otherwise, MySQL cannot be started.
Rm/usr/local/mysql/data/ib_logfile1 # Delete existing log files; otherwise, MySQL startup fails.


4. Start MySQL

Service mysqld start

Troubleshooting

The page is opened normally.

Ibdata1: Table data files under the InnoDB engine.

Suggestion: the database must be backed up. It is best to use the. SQL backup file for data recovery.

At this point, the MySQL database InnoDB engine server power-off data recovery tutorial is complete.

Related Article

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.