Description
A MySQL database server on the line suddenly loses power, causing a system failure to start, and after reinstalling the system, locate the previous MySQL database folder.
Problem:
Restore the previous MySQL database by copying the file, discovering that the tables in the database could not be found when the program was called, causing the Web site to not access properly.
Analysis:
1, MySQL database, using Copy file method to restore the database, only support MyISAM engine;
2, if there is a database or data table using the InnoDB engine, the recovery, must be accompanied by the MySQL database directory ibdata1 file together with the copy.
Workaround:
1. Stop MySQL Service
Service Mysqld Stop
2. Backup database files before searching
cd/home/mysql_bak/mysql/#进入MySQL备份目录
Ibdata1 #需要此文件
3. Copy the Ibdata1 file to the corresponding directory of the database
Cp/home/mysql_bak/mysql/ibdata1/usr/local/mysql/data/ibdata1 #拷贝文件到现在的数据库目录
Chown mysql.mysql/usr/local/mysql/data/ibdata1 #设置权限位mysql用户和用户组
Rm/usr/local/mysql/data/ib_logfile0 #删除现有日志文件 or failed to start MySQL
Rm/usr/local/mysql/data/ib_logfile1 #删除现有日志文件 or failed to start MySQL
System operation and maintenance www.osyunwei.com warm reminder: system operation and maintenance of original content © Copyright, reproduced please indicate the source and the original link
4. Start MySQL
Service mysqld Start
Fault resolution
The page is now open normally.
ibdata1 function: The table data file under the InnoDB engine.
Recommendation: The database must be well backed up, the recovery of data is best used. SQL backup file Import.
At this point, the MySQL database InnoDB engine server power down data Recovery tutorial completed.
MySQL database InnoDB engine server power down data recovery