{"id":833,"date":"2018-05-15T21:36:04","date_gmt":"2018-05-15T19:36:04","guid":{"rendered":"http:\/\/itsimple.info\/?p=833"},"modified":"2019-05-31T07:05:10","modified_gmt":"2019-05-31T05:05:10","slug":"how-to-fix-corrupted-table-in-mariadb-database-when-service-not-start-with-signal-6","status":"publish","type":"post","link":"https:\/\/itsimple.info\/?p=833","title":{"rendered":"How To Fix Corrupted Table in MariaDB Database when Service not start with signal 6"},"content":{"rendered":"<p>Some times MariaDB get currupted and you can get : [ERROR] mysqld got signal 6 ;\u00a0\u00a0 that probably means that one of your databses are in bad state or have currupted Table data inside, here is how you can fix this , start mysql in recovery mode -&gt; add this line to <em>etc\/my.cnf<\/em> :<\/p>\n<pre>[mysqld]\r\nport = 8889\r\ninnodb_force_recovery=3\r\ninnodb_purge_threads=0<\/pre>\n<p>&nbsp;<\/p>\n<p>*. The innodb_force_recovery have 6 levels, 3 include 1+2 so innodb_force_recovery=6 is the most intensive level. Now Lets try to start again :<\/p>\n<pre>systemctl start mariadb.service<\/pre>\n<p>This start procedure will start the DB in read-only mode ! now lets check all the databases :<\/p>\n<pre>mysqlcheck --all-databases<\/pre>\n<p>You will get all status of all the databases table including the Corrupted ones,<\/p>\n<pre>zabbix.sysmaps\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.sysmaps_elements\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.sysmaps_link_triggers\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.sysmaps_links\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.task\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.task_close_problem\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.timeperiods\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.trends\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.trends_uint\r\nWarning\u00a0 : InnoDB: The B-tree of index \"PRIMARY\" is corrupted.\r\nerror\u00a0\u00a0\u00a0 : Corrupt\r\nzabbix.trigger_depends\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.trigger_discovery\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.trigger_tag\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.triggers\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.users\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.users_groups\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.usrgrp\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK\r\nzabbix.valuemaps\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 OK<\/pre>\n<p>&nbsp;<\/p>\n<p>To Check one Database (zabbix in this examples):<\/p>\n<pre> mysqlcheck -c zabbix<\/pre>\n<p>To Check all Databases on the server :<\/p>\n<pre> mysqlcheck -c --all-databases<\/pre>\n<p>To Optimize one table from the Database :<\/p>\n<pre>mysqlcheck -o zabbix actions<\/pre>\n<p>To Repair the Database:<\/p>\n<pre>mysqlcheck --auto-repair zabbix<\/pre>\n<p>To Repair one table from the Database:<\/p>\n<pre>mysqlcheck -r zabbix trends.uint<\/pre>\n<p>You can combine check, optimize and repair functionality together using \u201c\u2013auto-repair\u201d<\/p>\n<pre>mysqlcheck --auto-repair -c -o zabbix<\/pre>\n<p>lets assume you want to empty one table which have corrupted data inside, in this example zabbix.trends_uint have index corrupted, lets empty this table :<\/p>\n<pre>[root@localhost ~]# mysql\r\nWelcome to the MariaDB monitor.\u00a0 Commands end with ; or \\g.\r\nYour MariaDB connection id is 226\r\nServer version: 5.5.56-MariaDB MariaDB Server\r\n\r\nCopyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n\r\nMariaDB [(none)]&gt; TRUNCATE TABLE zabbix.trends_uint;\r\nQuery OK, 0 rows affected (0.03 sec)\r\n\r\nMariaDB [(none)]&gt; quit<\/pre>\n<p>Now stop the service :<\/p>\n<pre>systemctl stop mariadb.service<\/pre>\n<p>And then delete or # the lines we add to the etc\/my.cnf<\/p>\n<pre>[mysqld]\r\n#port = 8889\r\n#innodb_force_recovery=3\r\n#innodb_purge_threads=0<\/pre>\n<p>Then start the service again<\/p>\n<pre>systemctl stop mariadb.service<\/pre>\n<p>The service should run with no more errors !!!<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Additional Useful Mysqlcheck Options<\/strong><\/p>\n<p>&nbsp;<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1127\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2018\/05\/Mysqlcheck_Options-300x263.png\" alt=\"\" width=\"696\" height=\"610\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2018\/05\/Mysqlcheck_Options-300x263.png 300w, https:\/\/itsimple.info\/wp-content\/uploads\/2018\/05\/Mysqlcheck_Options.png 595w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/p>\n<hr \/>\n<h3>Good Luck<\/h3>\n","protected":false},"excerpt":{"rendered":"<p>Some times MariaDB get currupted and you can get : [ERROR] mysqld got signal 6 ;\u00a0\u00a0 that probably means that one of your databses are in bad state or have currupted Table data inside, here is how you can fix this , start mysql in recovery mode -&gt; add this line to etc\/my.cnf : [mysqld] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,21,4,12],"tags":[],"class_list":["post-833","post","type-post","status-publish","format-standard","hentry","category-linux","category-operating-systems","category-tech","category-tutorials"],"_links":{"self":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/833","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=833"}],"version-history":[{"count":0,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/833\/revisions"}],"wp:attachment":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}