This article mainly introduces how to recover data from server power failure in the InnoDB engine of MySQL database. For more information, see
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.
The above is the server power-off data recovery method _ MySQL content under the InnoDB engine of MySQL database. For more information, see PHP Chinese network (www.php1.cn )!