MySQL Error code 145: Repair the Crashed Tables in WordPress

For many reasons, including the wrong server configuration and settings and the poor database optimization, the MySQL database in WordPress, and in any other platform can show errors like “#145 – Table …” or similar messages like errors establishing a database connection.

In the case of error 145, the messages will be followed by phrases, like:

is marked as crashed and should be repaired.

That shows you the solution from the beginning. You have corrupted database tables and you have to repair them in order to make things work again.

Fixing crashed database tables with error code 145

To fix this database table problem, you need to have access to your phpMyAdmin area first, and then, you can follow the following tutorial. But first, make sure that you have at least one backup of your full website, and database before doing anything. If something wrong happens, you still have the backup to restore the full database.

So, log in to cPanel first, and then locate the “phpMyAdmin” icon and click on it. Once you’re in phpMyAdmin, click the database name from the left area of the page, and you will get all the tables that are associated with that database. See the next screenshot, as an example to follow.

MySQL Error code 145

Now, you will get a successful notification about the table repair. This will fix the problem in the majority of cases, and you don’t need any additional steps or verification. However, if nothing happens and you still get that error message in MySQL, then, you need to reinstall your database tables manually. It’s not a hard job if you follow my steps.

Make sure you have a backup with your latest posts, and I hope that you will never lose any single word from your work. If you’re using automated daily backup services, for example, you will find your latest backup files. That way you can restore the website as it was exactly.

Once you have the backup file, search for the database, in general, it comes in a compressed file. Then, download it and use your cPanel account to upload that old database, as a restore.

All you have to do is to click the “Backups” icon, next, find “restore a MySQL database” from the left section of the page, and select your file from the local computer. Now, wait for the upload to complete, and you will get a notification about the successful database restore.

Related:  Top 10 Responsive WordPress Themes

Create a user for that database and add all the permissions for it. Now, you need to connect your restored database to WordPress. For this step, open the file “wp-config.php” that you will find in the website root directory.

In the File manager, open that file and update your database name, username, and user password with the new details. Then save that file and open your blog page to verify.

For a step by step tutorial, read: how to move a WordPress database and also, you can import the WordPress database in phpMyAdmin, it’s another easy step if you can’t use the standard cPanel method for restoring databases.

Please make sure that you have a compatible version of MySQL. In some rare cases, people find that they are using an outdated version, that is not supported by WordPress, and that will cause problems with restoring tables and even repairing them.

Avatar for Fathi Arfaoui
About Fathi Arfaoui

Fathi Arfaoui is a Physicist, Blogger and the founder of Trustiko.com. He shares Business, WordPress and Blogging tips to build a better blog and succeed online.

Disclosure: The recommendations on this page are my own based on my tests and analysis. We may earn a small commission from web hosts and other partners if you use my referral link to make a purchase. That’s what helps us to maintain the site and add fresh content, Thanks for your support.

Leave a Comment