WordPress depends on the proper functioning of the MySQL database. If you suspect that your database has been corrupted, you can repair it. A corrupt database can be recognized by missing data or sometimes a lost connection. This can sometimes mean that you can't get into your WP-admin anymore.


Attention! Before you try to repair your database, it is wise to make a backup of your database. This can be done via admin.savvii.com

There are three ways to repair your database:


1. With WP_ALLOW_REPAIR in the wp-config.php

WordPress can restore your database itself. To instruct WordPress to do this, you must add the following line to your wp-config.php. This file can be found via sFTP in the wordpress/current/-map of your site.

define('WP_ALLOW_REPAIR', true);
Text


Overwrite the original wp-config.php with the modified version. Make sure you don't edit anything else in the file.


Then go to https://www.yoursite.com/wp-admin/maint/repair.php


There's the next screen: 


database repair wp




Here you can see the options to repair the database, or to repair and optimize it. For a standard repair of your database, the first option is sufficient. Optimizing your database leads to an unreachable website, so this may be undesirable.


Please note! When the repair is finished don't forget to remove the line you just added.


2. Via phpMyAdmin

You can also perform the database repair using the phpMyAdmin. To do this, you will need the login details of your database. These can be found in the email sent to you when your hosting package was delivered, or in the wp-config.php. These can be found via sFTP in the wordpress/current/ folder. In your wp-config.php you can also read which database server you need.


The phpMyAdmin can be found for all Shared packages via admin.savvii.com, via the Database tab. For VPS this will be communicated to you when phpMyAdmin is enabled. Read more about phpMyAdmin on VPS here.


If you are logged in to phpMyAdmin, click through to your site's database. There you can select all the tables you want to repair. Then choose for Repair Table. This will be done immediately. 



Screenshot from 2019-02-06 15-50-19

  

3. Via SSH (only on VPS when requested)

Via SSH you can repair your database with the following command:


mysqlcheck -u SYSTEM NAME -p --auto-repair SYSTEM NAME
Text


Replace SYSTEM NAME with your Savvii username (which you can also use as a username to login to SSH). You will then be asked for a password: this is the password of the database. This can be found in your wp-config.php.