{"id":20672,"date":"2020-11-30T04:51:42","date_gmt":"2020-11-29T20:51:42","guid":{"rendered":"https:\/\/web.mwwsb.com.my\/pjci\/?post_type=kb&#038;p=20672"},"modified":"2022-09-08T19:13:43","modified_gmt":"2022-09-08T11:13:43","slug":"how-to-repair-mysql-databases-and-tables","status":"publish","type":"kb","link":"https:\/\/www.casbay.com\/guide\/kb\/how-to-repair-mysql-databases-and-tables","title":{"rendered":"HOW TO: Repair MySQL databases and tables"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"20672\" class=\"elementor elementor-20672\" data-elementor-post-type=\"kb\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-9e9694d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"9e9694d\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-50d2f3e\" data-id=\"50d2f3e\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-f7e13c2 elementor-widget elementor-widget-heading\" data-id=\"f7e13c2\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">HOW TO: Repair MySQL databases and tables<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9a920b2 elementor-widget elementor-widget-text-editor\" data-id=\"9a920b2\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>In this article, we will guide you to repair MYSQL databases and tables. <strong>Please follow the steps below<\/strong>:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fe4c4ac elementor-widget elementor-widget-heading\" data-id=\"fe4c4ac\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-large\">STEP 1: BACKING UP THE DATABASES<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3b1158b elementor-widget elementor-widget-text-editor\" data-id=\"3b1158b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Before you attempt to repair any database, you should back it up first. To back up all of the files from all of your databases, follow these steps:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-319d5e6 elementor-widget elementor-widget-text-editor\" data-id=\"319d5e6\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>1. Log in to your server using SSH.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a8d6489 elementor-widget elementor-widget-text-editor\" data-id=\"a8d6489\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>2. Stop the MySQL server using the appropriate command for your Linux distribution:<\/p><ul><li style=\"list-style-type: none;\"><ul><li>For CentOS and Fedora, type:<br \/><pre class=\"command\">service mysqld stop<\/pre><\/li><li>For Debian and Ubuntu, type:<br \/><pre class=\"command\">service mysql stop<\/pre><\/li><\/ul><\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-42c943c elementor-widget elementor-widget-text-editor\" data-id=\"42c943c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>3. Type the following command:<\/p><pre class=\"command\">cp -rfv \/var\/lib\/mysql \/var\/lib\/mysql$(date +%s)<\/pre><div class=\"note\">This command copies all of the files from all of your databases to a directory name based on the current time (more precisely, the number of seconds elapsed since January 1, 1970). This ensures that each database backup is stored in a directory that has a unique name. For added protection, you can (and should) back up the database files to a remote location, not on the server.<\/div>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-02a7fde elementor-widget elementor-widget-text-editor\" data-id=\"02a7fde\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>4. Restart the MySQL server using the appropriate command for your Linux distribution:<\/p><ul><li style=\"list-style-type: none;\"><ul><li>For CentOS and Fedora, type:<br \/><pre class=\"command\">service mysqld start<\/pre><\/li><li>For Debian and Ubuntu, type:<br \/><pre class=\"command\">service mysql start<\/pre><\/li><\/ul><\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d566fcc elementor-widget elementor-widget-heading\" data-id=\"d566fcc\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-large\">STEP 2: CHECKING AND REPAIRING A TABLE WITH MYSQLCHECK<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-867d21a elementor-widget elementor-widget-text-editor\" data-id=\"867d21a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>After you back up your databases, you are ready to start troubleshooting. The\u00a0<em>mysqlcheck<\/em>program enables you to check and repair databases while MySQL is running. This feature is useful when you want to work on a database without stopping the entire MySQL service.<\/p><p>Additionally,\u00a0<em>mysqlcheck<\/em>\u00a0works on tables that use the MyISAM or InnoDB database engines.<\/p><div class=\"note\">For information about how to determine which storage engine a database table is using, please see\u00a0<a href=\"https:\/\/www.casbay.com\/guide\/kb\/working-with-mysql-database-engines\/\" data-wpel-link=\"internal\">this article<\/a>.<\/div><p>To use\u00a0<em>mysqlcheck<\/em>, follow these steps:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2487471 elementor-widget elementor-widget-text-editor\" data-id=\"2487471\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>1. As the root user, type the following command:<\/p><pre class=\"command\">cd \/var\/lib\/mysql<\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3faeb4e elementor-widget elementor-widget-text-editor\" data-id=\"3faeb4e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>2. Type the following command, replacing <em>DATABASE<\/em>\u00a0with the name of the database that you want to check:<\/p><pre class=\"command\">mysqlcheck DATABASE<\/pre><div class=\"tip\"><p>The previous command checks all of the tables in the specified database. Alternatively, to check a specific table in a database, type the following command. Replace\u00a0<em>DATABASE<\/em>\u00a0with the name of the database, and replace\u00a0<em>TABLE<\/em>\u00a0with the name of the table that you want to check:<\/p><pre class=\"command\">mysqlcheck DATABASE TABLE<\/pre><\/div>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-75c9af9 elementor-widget elementor-widget-text-editor\" data-id=\"75c9af9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p><em>3. Mysqlcheck<\/em>\u00a0checks the specified database and tables. If a table passes the check,\u00a0<em>mysqlcheck<\/em>\u00a0displays\u00a0<strong>OK<\/strong>\u00a0for the table. However, if\u00a0<em>mysqlcheck<\/em>\u00a0reports an error for a table, type the following command to try to repair it. Replace\u00a0<em>DATABASE<\/em>\u00a0with the database name, and\u00a0<em>TABLE<\/em>\u00a0with the table name:<\/p><pre class=\"command\">mysqlcheck -r DATABASE TABLE<\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9abccfe elementor-widget elementor-widget-text-editor\" data-id=\"9abccfe\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>4. If <em>mysqlcheck<\/em>\u00a0cannot successfully repair the table or tables, go to the following procedure.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e29962d elementor-widget elementor-widget-heading\" data-id=\"e29962d\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-large\">STEP 3: RUNNING ENGINE-SPECIFIC DIAGNOSTICS<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-946aa41 elementor-widget elementor-widget-text-editor\" data-id=\"946aa41\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>If running\u00a0<em>mysqlcheck<\/em>\u00a0does not fix the problem, the next step is to run diagnostics specific to the engine used by the database table or tables. Follow the appropriate procedure below for your table\u2019s database storage engine.<\/p><div class=\"note\">For information about how to determine which storage engine your database tables are using, please see\u00a0<a href=\"https:\/\/www.casbay.com\/guide\/kb\/working-with-mysql-database-engines\/\" data-wpel-link=\"internal\">this article<\/a>.<\/div>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ba3809c elementor-widget elementor-widget-heading\" data-id=\"ba3809c\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-medium\">Repairing MyISAM tables with myisamchk<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-60a24a3 elementor-widget elementor-widget-text-editor\" data-id=\"60a24a3\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"mkb-anchor mkb-clearfix mkb-back-to-top-inline\"><p>If you are using the MyISAM storage engine for a table, you can run the myisamchkprogram to repair it. To do this, follow these steps:<\/p><\/div><div class=\"important\">Note: The <em>myisamchk<\/em>\u00a0program only works for tables that use the MyISAM storage engine. It does not work for the InnoDB engine.<\/div>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-44a6146 elementor-widget elementor-widget-text-editor\" data-id=\"44a6146\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<ol><li>Firstly, stop the MySQL server using the appropriate command for your Linux distribution:<\/li><\/ol><ul><li style=\"list-style-type: none;\"><ul><li>For CentOS and Fedora, type:<br \/><pre class=\"command\">service mysqld stop<\/pre><\/li><li>For Debian and Ubuntu, type:<br \/><pre class=\"command\">service mysql stop<\/pre><\/li><\/ul><\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-03537f0 elementor-widget elementor-widget-text-editor\" data-id=\"03537f0\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>2. Secondly, ype the following command:<\/p><p><span style=\"background-color: #eeeeee; font-family: 'Courier 10 Pitch', Courier, monospace; font-size: 1em;\">cd \/var\/lib\/mysql<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9be9584 elementor-widget elementor-widget-text-editor\" data-id=\"9be9584\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>3. Change to the directory where the database is located. For example, if the database is named <em>customers<\/em>, type\u00a0<span class=\"user-input\">cd customers<\/span>.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8e84a50 elementor-widget elementor-widget-text-editor\" data-id=\"8e84a50\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>4. Next, ype the following command, replacing the <em>TABLE<\/em>\u00a0with the name of the table that you want to check:<\/p><pre class=\"command\">myisamchk TABLE<\/pre><div class=\"tip\"><div class=\"tip\"><p>To check all of the tables in a database, type the following command:<\/p><pre class=\"command\">myisamchk *.MYI<\/pre><\/div><div class=\"important\"><p>If the previous command does not work, you can try deleting temporary files that may be preventing\u00a0<em>myisamchk<\/em>\u00a0from running correctly. To do this, change back to the\u00a0<em>\/var\/lib\/mysql<\/em>\u00a0directory, and then type the following command:<\/p><pre class=\"command\">ls *\/*.TMD\n<\/pre><p>If there are any .TMD files listed, type the following command to delete them:<\/p><pre class=\"command\">rm *\/*.TMD<\/pre><p>Then try to run\u00a0<em>myisamchk<\/em>\u00a0again.<\/p><\/div><\/div>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-382d314 elementor-widget elementor-widget-text-editor\" data-id=\"382d314\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>5. To try to repair a table, type the following command, replacing the <em>TABLE<\/em>\u00a0with the name of the table that you want to repair:<\/p><pre class=\"command\">myisamchk --recover <em>TABLE<\/em><\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4d7be78 elementor-widget elementor-widget-text-editor\" data-id=\"4d7be78\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>6. After that, estart the MySQL server using the appropriate command for your Linux distribution:<\/p><ol><li style=\"list-style-type: none;\"><ul><li>For CentOS and Fedora, type:<br \/><pre class=\"command\">service mysqld start<\/pre><\/li><li>For Debian and Ubuntu, type:<br \/><pre class=\"command\">service mysql start<\/pre><\/li><\/ul><\/li><\/ol>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c5cb278 elementor-widget elementor-widget-text-editor\" data-id=\"c5cb278\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>7. Lastly, test the repaired table or tables.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-978a2f8 elementor-widget elementor-widget-heading\" data-id=\"978a2f8\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-medium\">Running the InnoDB recovery process<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1710517 elementor-widget elementor-widget-text-editor\" data-id=\"1710517\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>If you are using the InnoDB storage engine for a database table, you can run the InnoDB recovery process. To do this, follow these steps:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-83c96b3 elementor-widget elementor-widget-text-editor\" data-id=\"83c96b3\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>1. Firstly, use your preferred text editor to open the <em>my.cnf<\/em>\u00a0file on your server. The location of the\u00a0<em>my.cnf<\/em>\u00a0file depends on your Linux distribution:<\/p><ul><li style=\"list-style-type: none;\"><ul><li>On CentOS and Fedora, the\u00a0<em>my.cnf<\/em>\u00a0file is located in the\u00a0<strong>\/etc<\/strong>\u00a0directory.<\/li><li>On Debian and Ubuntu, the\u00a0<em>my.cnf<\/em>\u00a0file is located in the\u00a0<strong>\/etc\/mysql<\/strong>\u00a0directory.<\/li><\/ul><\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4beed31 elementor-widget elementor-widget-text-editor\" data-id=\"4beed31\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>2. Secondly, in the <em>my.cnf<\/em>\u00a0file, locate the\u00a0<strong>[mysqld]<\/strong> section.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c666193 elementor-widget elementor-widget-text-editor\" data-id=\"c666193\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>3. Add the following line to the <strong>[mysqld]<\/strong>\u00a0section:<\/p><pre class=\"code\">innodb_force_recovery=4<\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a6b633c elementor-widget elementor-widget-text-editor\" data-id=\"a6b633c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>4. Next, save the changes to the <em>my.cnf<\/em>\u00a0file, and then restart the MySQL server using the appropriate command for your Linux distribution:<\/p><ol><li style=\"list-style-type: none;\"><ul><li>For CentOS and Fedora, type:<br \/><pre class=\"command\">service mysqld restart<\/pre><\/li><li>For Debian and Ubuntu, type:<br \/><pre class=\"command\">service mysql restart<\/pre><\/li><\/ul><\/li><\/ol>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6395654 elementor-widget elementor-widget-text-editor\" data-id=\"6395654\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>5. After that, type the following command to export all of the databases to the <em>databases.sql<\/em>\u00a0file:<\/p><pre class=\"command\">mysqldump --all-databases --add-drop-database --add-drop-table &gt; databases.sql<\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0ba9fe4 elementor-widget elementor-widget-text-editor\" data-id=\"0ba9fe4\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>6. Start the <em>mysql<\/em>\u00a0program, and then try to drop the affected database or databases using the\u00a0<strong>DROP DATABASE<\/strong>\u00a0command.<\/p><div class=\"note\">If MySQL is unable to drop a database, you can delete it manually in step 8 below after you stop the MySQL server.<\/div>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0b10639 elementor-widget elementor-widget-text-editor\" data-id=\"0b10639\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>7. Stop the MySQL server using the appropriate command for your Linux distribution:<\/p><ul><li>For CentOS and Fedora, type:<br \/><pre class=\"command\">service mysqld stop<\/pre><\/li><li>For Debian and Ubuntu, type:<br \/><pre class=\"command\">service mysql stop<\/pre><\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2db0a9b elementor-widget elementor-widget-text-editor\" data-id=\"2db0a9b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>8. If you were unable to drop a database in step 6, type the following commands to delete it manually. Replace\u00a0<em>DBNAME<\/em>\u00a0with the name of the database that you want to delete:<\/p><pre class=\"command\">cd \/var\/lib\/mysql\nrm -rf <em>DBNAME<\/em><\/pre><div class=\"important\">Make sure you do not delete the\u00a0<em>mysql<\/em>\u00a0or\u00a0<em>performance_schema<\/em>directories!<\/div>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ad7e911 elementor-widget elementor-widget-text-editor\" data-id=\"ad7e911\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>9. Next, use your preferred text editor to open the <em>my.cnf<\/em>\u00a0file on your server, and then comment out the following line in the\u00a0<strong>[mysqld]<\/strong>\u00a0section as shown:<\/p><pre class=\"code\">#innodb_force_recovery=4<\/pre><div class=\"note\">This disables InnoDB recovery mode.<\/div>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4dea1b1 elementor-widget elementor-widget-text-editor\" data-id=\"4dea1b1\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>10. Save the changes to the <em>my.cnf<\/em>\u00a0file, and then start the MySQL server using the appropriate command for your Linux distribution:<\/p><ul><li>For CentOS and Fedora, type:<br \/><pre class=\"command\">service mysqld start<\/pre><\/li><li>For Debian and Ubuntu, type:<br \/><pre class=\"command\">service mysql start<\/pre><\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7980527 elementor-widget elementor-widget-text-editor\" data-id=\"7980527\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>11. Then, type the following command to restore the databases from the backup file you created in step 5:<\/p><pre class=\"command\">mysql &lt; databases.sql<\/pre>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-aecc77a elementor-widget elementor-widget-text-editor\" data-id=\"aecc77a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>12. Lastly, test the restored database.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>HOW TO: Repair MySQL databases and tables In this article, we will guide you to repair MYSQL databases and tables. Please follow the steps below: STEP 1: BACKING UP THE DATABASES Before you attempt to repair any database, you should back it up first. To back up all of the files from all of your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}}},"kbtopic":[60],"kbtag":[106],"mkb_version":[],"_links":{"self":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/20672"}],"collection":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/comments?post=20672"}],"version-history":[{"count":1,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/20672\/revisions"}],"predecessor-version":[{"id":31745,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/20672\/revisions\/31745"}],"wp:attachment":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/media?parent=20672"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=20672"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtag?post=20672"},{"taxonomy":"mkb_version","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/mkb_version?post=20672"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}