What Causes the WordPress and MySQL Error and How to Fix it?

what causes the wordpress and mysql error and how to fix it final featured image

“Your PHP installation appears to be missing the MySQL extension which is required by WordPress. Have you seen this error message after installing or browsing your WordPress website? So what is happening?

This problem has been reported by WordPress newcomers as well as experts. The main cause of this is that your website is experiencing problems connecting to your MySQL database.

WordPress’s primary database platform is the MySQL database. It is a relational database that is fast and dependable and has stood the test of time. It’s no surprise that WordPress uses it as their main database structure.

What Causes the WordPress and MySQL Error and How to Fix it

1. Incompatible PHP Versions

One of the possible reasons why we get this error is the version of PHP you use. To fix it, just go to your WordPress Dashboard then go to Tools > Site Health. On the Site Health page, go to info and find the Server accordion and click it.

Find the PHP Version label and you can see the version you are using.

how to update php version wordpress check php version in site info

If your PHP version is below 7.2, it would be better that you have to update it.

The latest PHP version is recommended in the WordPress platform since it has fewer errors and much faster than the older one.

How to update PHP in CPanel?

  • Login to your Hosting CPanel
  • Locate the MultiPHP Manager tool in the Software section of your cPanel.

what causes the wordpress and mysql error and how to fix it multi php manager

  • Click the checkbox for the domain(s) that you want to update.
  • From the drop-down menu labeled PHP version, select the latest version of PHP.

what causes the wordpress and mysql error and how to fix it select php version

  • Click the blue Apply button to save the change.

2. Outdated WordPress Core

If you have the most recent PHP version and an older WordPress version running, you will most likely experience issues. It would be preferable if everything was updated to correct these problems.

How do I update WordPress? Simply navigate to your dashboard, select “Update” from the menus, and click the update button. But, before you do that, make a backup of everything.

what causes the wordpress and mysql error and how to fix it update wordpress core

3. MySQL Extension Version

If your server is still working with PHP 5.6 or below, your server might don’t have the MySQL extension that WordPress needs.

To check if this is the problem, go back to your Site Health > Info > Database and check the Extension is there. Look for a section named either MySQL.

If you can’t find this information, that means the MySQL extension is not installed. The best fix is usually to contact your hosting support staff and ask them to install it for you.

4. Configure PHP Extension Properly

PHP extension is also known as PHP.ini file. Sometimes it has incorrect file path that may give us MySQL errors like above.

To check if the path is correct, We can see the location of our php.ini file in the public_html root folder.

In order to fix the error, properly copy the file to its’ proper path. Login to your hosting panel, navigate the files then move the php.ini file.

Leave a Comment

Scroll to Top