iDevie
June 2021
M T W T F S S
« May    
 123456
78910111213
14151617181920
21222324252627
282930  

Categories


In this quick article, we’ll discuss how to troubleshoot the “missing the MySQL extension” error when you are installing WordPress.

If you’re installing WordPress or you’ve moved your website to a different server, you may encounter the following error:

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

This can be frustrating for you as a WordPress admin, if you don’t know the cause of this error. Today, we’ll try to go through the possible solutions that could fix this error.

Before we go ahead and discuss the possible solutions, let’s quickly fetch the code which displays this error.

As you can see, WordPress is trying to load a couple of extensions that are related to MySQL. Specifically, it’s checking for the availability of the mysql, mysqli and mysqlnd PHP extensions. If WordPress finds that none of these extensions are installed and configured with your PHP, it won’t be able to work with your MySQL database. And thus, it complains so that you can take the necessary actions to fix it.

In this post, we’ll discuss the possible solutions you could use to fix this issue.

Verify the MySQL Extension Installation

The root cause of this error is the unavailability of the PHP extensions that are required for database operations. So the first thing is to check if one of the MySQL extensions are installed and enabled on your server. There are a a couple of ways you could do it.

First create an info.php file with the following contents.

Upload this file to the document root of your WordPress website. Next, open the https://your-wordpress-website/info.php URL in your browser and it should display the PHP configuration information as shown in the following screenshot.

Phpinfo

Now, try to find the mysql or mysqli extension section. If one of these are installed and configured in your PHP installation, you should be able to find them as shown in the following screenshot.

Mysqli Section

If you don’t find it, it means that it’s not installed on your server. In this case, you just need to install the mysql or mysqli extension, and you’re good to go.

If you want to install it yourself, take a look at my article explaining how to install specific PHP extensions on your server. You’ll need to have root access to your server shell in order to be able to install it yourself. If you don’t have access or you don’t want to mess with server admin, you could ask your hosting provider and they should be able to do it for you pretty quickly.

In most cases, this is the root cause of this error. After installing the necessary extension, your WordPress site should start working.

On the other hand, if you find that the necessary extensions are installed and configured properly, and still you’re getting this error, you could go through the next section to see if that works for you.

Verify the WordPress Version

It could be that you’re running an old WordPress version, but that PHP and related extensions are upgraded to the latest version on your server. For example, if you have moved your site to a new hosting provider, this could cause a version incompatibility between your WordPress and PHP versions.

If you find that you’re running old WordPress version, I would recommend you to upgrade your site to the latest version. When you upgrade your WordPress, it replaces old files with new files and that may fix this error. You can learn how to upgrade your WordPress version in this article.

Of course, even if you don’t have any errors, it’s recommended to upgrade your WordPress periodically to the latest stable version. This will help protect you against any security vulnerabilities that may exist in the older WordPress version.

Conclusion

Today, we discussed a couple possible solutions to the “missing the MySQL extension” error in WordPress. Let me know in the comments below if you have any other questions! And check out some of our other posts for more WordPress tips and tricks.


Comments 0
There are currently no comments.