Your PHP installation appears to be missing the MySQL extension which is required by WordPress Error and Solution

by on April 19, 2008 · 28 comments· LAST UPDATED May 27, 2013

in , ,

I'm setting up WordPress based blog system under Debian or Ubuntu Linux. I am getting an error which read as follows:

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
RequirementsNone
Estimated completion timeN/A

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

How do I fix this problem under Debian or Ubuntu Linux?

First, make sure MySQL server is running. Type the following command at a shell prompt:
# /etc/init.d/mysql status
If MySQL is not running, enter:
# /etc/init.d/mysql start
If MySQL is not installed, type the following command to install MySQL server:
# apt-get install mysql-server
Make sure MySQL module for php5 is installed:
# dpkg --list | grep php5-mysql
To install php5-mysql module enter:
# apt-get install php5-mysql
Next, restart the Apache2 web server:
# /etc/init.d/apache2 restart
Now PHP support for MySQL should work without a problem. Also make sure you set localhost or 127.0.0.1 as MySQL hostname while performing wordpress installation.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 28 comments… read them below or add one }

1 Deb April 27, 2008 at 8:32 pm

I’m having the same problem trying to install on my localhost in Windows XP environment – any tips on how to fix that? I tried the above and that didn’t work. I’m running Apache 2 and PHP MyAdmin 5.2 (I believe). Everything else works fine and I can create and access MySQL databases in PHP MyAdmin without any issues.

Reply

2 Callum August 3, 2008 at 11:09 am

The reason it didn’t work is because this is for a linux environment, not Windows.

Reply

3 David October 14, 2008 at 8:13 am

Thanks, that did it for me.

Reply

4 billythekid December 13, 2008 at 12:40 am

Thanks for this, I’ve been trying various “fixes” all night, this did the trick for me. Props!

Reply

5 Matt December 30, 2008 at 4:40 am

This was super useful. Thanks for the post.

Reply

6 Mariana April 6, 2009 at 11:43 am

I am trying to install wordpress under debian.
It is not my first installation, neither the second. It always gone ok.
Not I got the same error pointed out here (you can go to the website). I do have php-server installed and running, I do have php5 installed. I do have the module php5-mysql.

And it still gives me the same error.

Who can help me?

Thanks, Mariana

Reply

7 Mariana April 6, 2009 at 11:45 am

Sorry I wrote “Not I got the same error ..”, I meant “Now I got the same error..”

And also “I do have php-server installed and running”, I meant “I do have mysql-server installed and running”

Reply

8 Biju Subhash April 29, 2009 at 11:25 am

Thank you for sharing…
nice post..

Biju Subhash

Reply

9 Nguyen Lan May 7, 2009 at 7:46 pm

Thanks for shared but I host on godaddy so How can I do with this problem. My host is shared hosting on Window. Can you show me.
Thanks

Reply

10 John May 12, 2009 at 1:58 am

Thanks so much!

Followed your process, step by step. Worked like a charm first time!

Reply

11 aldeol July 13, 2009 at 10:09 am

Thank you so much. I have solved my problem. Thank you again for this useful article…

Reply

12 BentleyCoup August 15, 2009 at 7:25 am

Thanks i stumbled on the same problem. One would think that the mysql module would be included with PHP5 without asking for it.

Reply

13 Jasper December 16, 2009 at 2:11 pm

Thanks. This was a life saver for my local installation on a Ubuntu Virtual Partition!

Reply

14 lacops June 10, 2010 at 10:38 am

So simple and yet such a great help!

Thank you so much :-)

Reply

15 blesbok June 11, 2010 at 11:12 pm

Thank you, this was very handy. Turned out all that was left to do was to restart Apache. Almost felt I could kick myself…

Reply

16 Phoreys July 21, 2010 at 4:01 pm

Nice! That fixed my issues…

Reply

17 John Connor September 27, 2010 at 7:24 pm

Thanks, that solved my problem.

Reply

18 asu February 13, 2011 at 1:25 am

stupid solution…:(

Reply

19 PB April 11, 2011 at 2:04 am

This fixed it for me. Gracias!

Reply

20 Ghostetr January 4, 2012 at 12:55 am

THANKS THIS WAS A HUGE HELP :D
hehe i just reinstalled my ubunto and updated to version 11.10
i had install the mysql extension but forgot to start it
ty for your help :D

Reply

21 Cindy November 17, 2012 at 12:33 pm

Morning….The blog has been working for YEARS, then all of a sudden this morning I am getting: Your PHP installation appears to be missing the MySQL extension which is required by WordPress.. I’ve read the above but I don’t know what it means. I also can’t access my control panel inside of wordpress anymore. Can someone please give me step-by-step on how to fix this? I need this back up asap. Thank you!

Reply

22 ITN John November 17, 2012 at 1:12 pm

First, these commands need to be typed using a ssh session. Can you access your server using SSH? Are you a server admin? Is your server is managed by a hosting company? Is it on a shared hosting account? If so contact tech support. These commands will only work if you know how to use ssh and login as root user.

Reply

23 Tom January 15, 2013 at 8:35 pm

Old post I know, but I’m trying to run MySQL 5.1.58 on Ubuntu 12.04, It’s a task I was assigned. I’m also trying to run Apache and PHP5. I compiled MySQL 5.1.58 and apt-get both Apache and PHP5. Everything works great, but when I try to connect PHP and MySQL with php5-mysql, it breaks MySQL.

When I run ./bin/mysqld_safe –user=mysql &, I get an error about /var/lib/mysql for .err, not being there. I tried ln -s to the mysql install location, that fixes that error. When I check the .err file it says:

[ERROR] Can’t find messagefile ‘usr/share/english/errmsg.sys’
[Note] Plugin ‘FEDERATED’ is disabled.
/usr/local/mysql/bin/mysqld: Uknown error 1146
[ERROR] Can’t open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: Initializing buffer pool, size = 8.0M
InnoDB: Completed initialization of buffer pool
InnoDB: Operating system error number 13 in file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: ‘create’.
InnoDB: Cannot continue operation.
mysqld_safe mysqld from pid fiel /var/run/mysqld/mysqld.pid ended

I don’t understand what ‘access rights’ mysqld needs, when I check them, mysql user has ownership of data file in /usr/local/mysql/. Is there something I’m missing/doing wrong? Appreciate any help.

Reply

24 Shahreer March 18, 2013 at 6:00 pm

Hi, I need this solution on Windows not Linux. Pls help me!!!

Reply

25 Shahul August 9, 2013 at 9:21 am

Thanks :) It worked

Reply

26 Ernesto David Lazalde December 26, 2013 at 11:03 pm

As an alternative to the above solution, you can simply apply the following patch to your Wordpress:

http://wordpress.org/plugins/mysqli/

The full instructions are at the link, but it simply involves extracting the compressed folder and copying the db.php file into your wp-content directory. It quickly fixed the problem for me (I am using Fedora Linux with PHP 5.5.7).

Reply

27 Marco April 1, 2014 at 5:04 pm

Thanks!!

Reply

28 Suliman April 3, 2014 at 7:02 pm

It works just fine with me, Thanks alot

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , ,

Previous Faq:

Next Faq: