Skip to main content

Optimise my.cnf

Comments

8 comments

  • cPanelMichael
    Hello :) You may find the following thread helpful based on the output of your MySQL error log: InnoDB Corruption Repair Guide Thank you.
    0
  • abdelhost77
    Hello Sir, i identify the corrupted table by running mysqlcheck, i delete the database containing this table from cpanel => delete database, but after that Mysql wont be started, please it is very urgent as it is production server with many sites, your help is much appreciated .
    141022 17:51:02 [Note] Event Scheduler: Loaded 1 event 141022 17:51:02 [Note] /usr/sbin/mysqld: ready for connections. Version: '5.1.73-cll' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPLv2) InnoDB: A new raw disk partition was initialized or InnoDB: innodb_force_recovery is on: we do not allow InnoDB: database modifications by the user. Shut down InnoDB: mysqld and edit my.cnf so that newraw is replaced InnoDB: with raw, and innodb_force_... is removed. InnoDB: A new raw disk partition was initialized or InnoDB: innodb_force_recovery is on: we do not allow InnoDB: database modifications by the user. Shut down InnoDB: mysqld and edit my.cnf so that newraw is replaced InnoDB: with raw, and innodb_force_... is removed. InnoDB: A new raw disk partition was initialized or InnoDB: innodb_force_recovery is on: we do not allow InnoDB: database modifications by the user. Shut down InnoDB: mysqld and edit my.cnf so that newraw is replaced InnoDB: with raw, and innodb_force_... is removed. InnoDB: A new raw disk partition was initialized or InnoDB: innodb_force_recovery is on: we do not allow InnoDB: database modifications by the user. Shut down InnoDB: mysqld and edit my.cnf so that newraw is replaced InnoDB: with raw, and innodb_force_... is removed. 141022 17:51:07 [Note] /usr/sbin/mysqld: Normal shutdown 141022 17:51:07 [Note] Event Scheduler: Purging the queue. 1 events 141022 17:51:09 InnoDB: Starting shutdown...
    0
  • cPanelMichael
    Do you have innodb_force_recovery enabled in your /etc/my.cnf file? Thank you.
    0
  • abdelhost77
    yes it is innodb_force_recovery=4 then i remove the innodb_force_recovery=4 and actually the logs shows that INNODB try to recover the table that has been deleted but fails and keep retrying wich is increasing highly the CPU, the logs shows :
    141022 18:53:00 [Note] Event Scheduler: Loaded 1 event 141022 18:53:00 [Note] /usr/sbin/mysqld: ready for connections. Version: '5.1.73-cll' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPLv2) InnoDB: Dropping table with id 0 11395 in recovery if it exists InnoDB: Table found: dropping table "badDb"."badTable" in recovery InnoDB: Error: tried to read 16384 bytes at offset 0 32768. InnoDB: Was only able to read 8192.
    knowin also that the table still exist in /var/lib/mysql even if deleted from Cpanel user account .
    /var/lib/mysql/badDb]# ls -lart ps_product_attachment.* -rw-rw---- 1 mysql mysql 98304 May 1 2013 badTable.ibd -rw-rw---- 1 mysql mysql 8620 Aug 13 23:07 badTable.frm
    0
  • abdelhost77
    i remove badTable.ibd and badTable.frm then restart mysql and then INNODB seems been able to remove data related to this table from internal data dictionnary and start succesfully, the CPU go back to normal, hope it is fixed now.
    0
  • abdelhost77
    Dear Sir, please help :( Mysql crashed again and wont be started : root@ [~]# /etc/init.d/mysql status MySQL is not running, but lock exists [FAILED] /etc/init.d/mysql start Starting MySQL..........Manager of pid-file quit without up[FAILED]ile. root@r [~]# Logs : /var/lib/mysql/*err
    141023 17:42:05 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 141023 17:42:05 [Warning] '--log_slow_queries' is deprecated and will be removed in a future release. Please use ''--slow_query_log'/'--slow_query_log_file'' instead. 141023 17:42:05 [Warning] '--safe-show-database' is deprecated and will be removed in a future release. Please use 'GRANT SHOW DATABASES' instead. 141023 17:42:05 [Note] Plugin 'FEDERATED' is disabled. 141023 17:42:05 InnoDB: Initializing buffer pool, size = 1.0G 141023 17:42:05 InnoDB: Completed initialization of buffer pool InnoDB: Log scan progressed past the checkpoint lsn 8 767061244 141023 17:42:05 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Error: tried to read 16384 bytes at offset 0 0. InnoDB: Was only able to read -1. 141023 17:42:18 InnoDB: Operating system error number 5 in a file operation. InnoDB: Error number 5 means 'Input/output error'. InnoDB: Some operating system error numbers are described at InnoDB: [url=http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html]MySQL :: MySQL 5.1 Reference Manual :: 14.6.12.6 Operating System Error Codes InnoDB: File operation call: 'read'. InnoDB: Cannot continue operation. 141023 17:42:18 mysqld_safe mysqld from pid file /var/lib/mysql/.pid ended
    i try with innodb_force_recovery=4 in /etc/my.cnf But it is not help .
    0
  • abdelhost77
    I try with innodb_force_recovery=5 in /etc/my.cnf then execute as root : mysqlcheck --all-databases -r than remove innodb_force_recovery=5 from /etc/my.cnf then /etc/init.d/mysql start and mysql Restarted in logs /var/lib/mysql/*err i found : 141023 18:05:05 InnoDB: Error: trying to open a table, but could not InnoDB: open the tablespace file './badDB/badTable.ibd'! InnoDB: Have you moved InnoDB .ibd files around without using the InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE? InnoDB: It is also possible that this is a temporary table #sql..., InnoDB: and MySQL removed the .ibd file for this. InnoDB: Please refer to InnoDB: [url=http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting-datadict.html]MySQL :: MySQL 5.1 Reference Manual :: 14.6.12.3 Troubleshooting InnoDB Data Dictionary Operations InnoDB: for how to resolve the issue. The logs are true, yesterday i removed manually /badDB/badTable.ibd . So let's now describe the scenario from begining to help if someone encounter the same problem . 1 - For some reason one cpanel table is corrumpted ( let say : badDB/badTable) 2 - the cpanel user remove the table from the cpanel account ( so the table is not deleted as root user so not well removed) 3 - Mysql start crashing 4 - After investigation you found that badDB/badTable.ibd still in /var/lib/mysql, and logs says that Mysql try to recover the data from this table but fails + high CPU 5 - You remove manually badDB/badTable.ibd from /var/lib/mysql, then mysql restart sucessfully indicating that data of badDB/badTable are removed from INNODB data dictionnary . 6 - if you try to restart Mysql, logs shows there still a corruption and still crash an still refering to /badDB/badTable.ibd in logs 7 - mysqlcheck --all-databases -r is executed 8- Mysql restart So the question now how to tell to INNODB MYSQL that i do not need anymore badDB/badTable and clean the cache and anything in INNODB engine refering to this table to avoid any possible furtur corruption/crash ?
    0
  • cPanelMichael
    It's likely a good idea to consult with a qualified system administrator that specializes in MySQL repair. Removing data is not always recommended for everyone as some may prefer to avoid any data loss. Thank you.
    0

Please sign in to leave a comment.