{"id":456,"date":"2014-07-30T21:18:57","date_gmt":"2014-07-30T21:18:57","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=456"},"modified":"2023-11-30T01:55:38","modified_gmt":"2023-11-30T01:55:38","slug":"mysql-checkrepair-database","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2014\/07\/30\/mysql-checkrepair-database\/","title":{"rendered":"Mysql Check\/Repair Database"},"content":{"rendered":"<p>Check a Specific Table in a Database<\/p>\n<p>If your application gives an error message saying that a specific table is corrupted, execute the mysqlcheck command to check that one table.<\/p>\n<p style=\"color: #111111;\">The following are some of the key options that you can use along with mysqlcheck.<\/p>\n<ul style=\"color: #111111;\">\n<li><strong>-A, \u2013all-databases<\/strong>\u00a0Consider all the databases<\/li>\n<li><strong>-a, \u2013analyze<\/strong>\u00a0Analyze tables<\/li>\n<li><strong>-1, \u2013all-in-1<\/strong>\u00a0Use one query per database with tables listed in a comma separated way<\/li>\n<li><strong>\u2013auto-repair<\/strong>\u00a0Repair the table automatically it if is corrupted<\/li>\n<li><strong>-c, \u2013check<\/strong>\u00a0Check table errors<\/li>\n<li><strong>-C, \u2013check-only-changed<\/strong>\u00a0Check tables that are changed since last check<\/li>\n<li><strong>-g, \u2013check-upgrade<\/strong>\u00a0Check for version dependent changes in the tables<\/li>\n<li><strong>-B, \u2013databases<\/strong>\u00a0Check more than one databases<\/li>\n<li><strong>-F, \u2013fast<\/strong>\u00a0Check tables that are not closed properly<\/li>\n<li><strong>\u2013fix-db-names<\/strong>\u00a0Fix DB names<\/li>\n<li><strong>\u2013fix-table-names<\/strong>\u00a0Fix table names<\/li>\n<li><strong>-f, \u2013force<\/strong>\u00a0Continue even when there is an error<\/li>\n<li><strong>-e, \u2013extended<\/strong>\u00a0Perform extended check on a table. This will take a long time to execute.<\/li>\n<li><strong>-m, \u2013medium-check<\/strong>\u00a0Faster than extended check option, but does most checks<\/li>\n<li><strong>-o, \u2013optimize<\/strong>\u00a0Optimize tables<\/li>\n<li><strong>-q, \u2013quick<\/strong>\u00a0Faster than medium check option<\/li>\n<li><strong>-r, \u2013repair<\/strong>\u00a0Fix the table corruption<\/li>\n<\/ul>\n<p>-c check<br \/>\n-o optimize<br \/>\n-r reapir<br \/>\n-a analyze<\/p>\n<p>For a Single database with all tables. The database name is &#8220;a026913f_gdy4rcc&#8221;<\/p>\n<pre>mysqlcheck -c database_name  -u database user -p\nEnter password:\na026913f_gdy4rcc.admin_adobe_ims_webapi OK\na026913f_gdy4rcc.admin_analytics_usage_version_log OK\na026913f_gdy4rcc.admin_passwords OK\na026913f_gdy4rcc.admin_system_messages OK\na026913f_gdy4rcc.admin_user OK\na026913f_gdy4rcc.admin_user_expiration OK\na026913f_gdy4rcc.admin_user_session OK\na026913f_gdy4rcc.adminnotification_inbox OK\na026913f_gdy4rcc.adobe_stock_asset OK\na026913f_gdy4rcc.adobe_stock_category OK\na026913f_gdy4rcc.adobe_stock_creator OK\na026913f_gdy4rcc.adobe_user_profile OK\na026913f_gdy4rcc.authorization_role OK\na026913f_gdy4rcc.authorization_rule OK\na026913f_gdy4rcc.braintree_credit_prices OK\na026913f_gdy4rcc.braintree_transaction_details OK\na026913f_gdy4rcc.cache OK\na026913f_gdy4rcc.cache_tag OK\na026913f_gdy4rcc.captcha_log OK\na026913f_gdy4rcc.catalog_category_entity OK\na026913f_gdy4rcc.catalog_category_entity_datetime OK\na026913f_gdy4rcc.catalog_category_entity_decimal OK\na026913f_gdy4rcc.catalog_category_entity_int OK\na026913f_gdy4rcc.catalog_category_entity_text OK\na026913f_gdy4rcc.catalog_category_entity_varchar OK\na026913f_gdy4rcc.catalog_category_product OK\na026913f_gdy4rcc.catalog_category_product_index OK\na026913f_gdy4rcc.catalog_category_product_index_replica OK\na026913f_gdy4rcc.catalog_category_product_index_store1 OK\na026913f_gdy4rcc.catalog_category_product_index_store1_replica OK\n\n.....\n\n<\/pre>\n<p>For Plesk<\/p>\n<p>Login to mysql on Plesk<\/p>\n<pre><pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;root@austin ~]# mysql -uadmin -p`cat \/etc\/psa\/.psa.shadow`\n\n<\/pre>\n<p>Check a single table in a database on linux server without plesk<\/p>\n<pre><pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;root@austin ~]# mysqlcheck -c database_name table -u root -p\n\n<\/pre>\n<p>[stextbox id=&#8221;alert&#8221; defcaption=&#8221;true&#8221; mode=&#8221;css&#8221;]For Plesk[\/stextbox]<\/p>\n<p>For repairing a single table<\/p>\n<pre><pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;root@austin ~]# mysqlcheck -r database_name table_name -uadmin -p`cat \/etc\/psa\/.psa.shadow`\n\n<\/pre>\n<p>Here is the command to run to repair all tables in a database.<\/p>\n<pre><pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;root@austin ~]# mysqlcheck -r database_name -uadmin -p`cat \/etc\/psa\/.psa.shadow`\n\n<\/pre>\n<p>Here is the command to run for all databases and tables<\/p>\n<pre><pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;root@austin ~]# mysqlcheck --all-databases -u admin -p`cat \/etc\/psa\/.psa.shadow` --auto-repair\n\n<\/pre>\n<p>For cPanel<\/p>\n<pre><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# mysqlcheck --all-databases -r #repair\n# mysqlcheck --all-databases -a #analyze\n# mysqlcheck --all-databases -o #optimize\n<\/pre>\n<p>Simple:<\/p>\n<pre><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# mysql -u username -p databasename\n# password: ********\nmysql&amp;amp;gt; check table tablename;\nmysql&amp;amp;gt; repair table tablename;\n\n<\/pre>\n<p>cPanel<\/p>\n<p>In cPanel, you can repair a database table by:<\/p>\n<p>cPanel -&gt; Databases -&gt; MySQL Databases<\/p>\n<p>You may need to go to Page 2, so under Current Databases [2] or &gt;&gt; to go to the next page. Under Modify Databases click [Check DB] or [Repair DB].<\/p>\n<p>Plesk<\/p>\n<p>Open the database in phpMyAdmin. To do that, go to your Plesk control panel, click \u201cWebsites and Domains,\u201d click \u201cDatabases,\u201d and then click the database in question. From there, click \u201cWebadmin\u201d under \u201cTools.\u201d You will most likely be presented with phpMyAdmin.<\/p>\n<p>Next, click \u201cDatabases\u201d in the upper right, click the database name, then scroll all the way down and click \u201cCheck All\u201d to check all the tables. From the drop down menu, select \u201cCheck Tables\u201d and your tables will immediately be checked. After that, you can decide which tables to select and choose \u201crepair\u201d from the drop down menu<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Check a Specific Table in a Database If your application gives an error message saying that a specific table is corrupted, execute the mysqlcheck command to check that one table. The following are some of the key options that you can use along with mysqlcheck. -A, \u2013all-databases\u00a0Consider all the databases -a, \u2013analyze\u00a0Analyze tables -1, \u2013all-in-1\u00a0Use &#8230; <a title=\"Mysql Check\/Repair Database\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2014\/07\/30\/mysql-checkrepair-database\/\" aria-label=\"Read more about Mysql Check\/Repair Database\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,70],"tags":[],"class_list":["post-456","post","type-post","status-publish","format-standard","hentry","category-administration","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/456","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=456"}],"version-history":[{"count":2,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/456\/revisions"}],"predecessor-version":[{"id":9042,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/456\/revisions\/9042"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}