Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Innodb_force_recovery forcibly fixes MySQL abnormal shutdown problem

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Add the following code to the mysql configuration file my.cnf: [mysqld] innodb_force_recovery=1 # can set 1-6innodb_purge_thread=0 # if the above configuration value is greater than 1, set it to 0 here, otherwise there will be errors in the configuration file parameters of InnoDB: Waiting for the background threads to start: innodb_force_recoveryinnodb_force_recovery affects the recovery status of the entire InnoDB storage engine. The default is 0, which means that all recovery operations (that is, check data pages / purge undo/insert buffer merge/rolling back&forward) are performed when recovery is needed, and mysql may not be able to start and log errors when valid recovery operations cannot be performed; innodb_force_recovery can be set to 1-6, with large numbers including the impact of all previous numbers. When the setting parameter value is greater than 0, you can select,create,drop the table, but operations such as insert,update or delete are not allowed. 1 (SRV_FORCE_IGNORE_CORRUPT): ignore checked corrupt pages. 2 (SRV_FORCE_NO_BACKGROUND): blocking the running of the main thread, if the main thread needs to perform full purge operations, will result in crash. 3 (SRV_FORCE_NO_TRX_UNDO): no transaction rollback operation is performed. 4 (SRV_FORCE_NO_IBUF_MERGE): merge operations that insert buffers are not performed. 5 (SRV_FORCE_NO_UNDO_LOG_SCAN): without viewing the redo log, the InnoDB storage engine treats uncommitted transactions as committed. 6 (SRV_FORCE_NO_LOG_REDO): roll forward is not performed. 2. Restart the database, log in to MySQL backup data mysqldump-uroot-p-- all-databases > back.sql3, comment out the two lines of code previously added in the my.cnf file, delete all files in the / var/lib/mysql/ directory, restart MySQL, and restart successfully. 4. Re-execute MySQL's security script mysql_secure_installation, set the root login password, and then log in to MySQL to restore the database. Source back.sql (absolute path to backup files)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report