Error: MySQL Driver not Installed

When I logged into Piwik today I was greeted with the message

An error occurred

Cannot connect to the database:

The mysql driver is not currently installed

This may be a temporary issue, try refreshing the page. If the problem persists please contact your Piwik administrator.

I have no idea why I am getting this message. The MySQL database & user both appear to be in good condition (I ran the Bluehost check on the database & everything was ok). This Piwik instance is roughly 8 months old and as it has been a while since I have logged in, so I don’t know how long this has been an issue.

Any help would be much appreciated.

You should try to understand if Piwik needs PDO PHP module or mysqli module. According config/global.ini.php the first adapter = PDO\MYSQL is default and recommended

My global.ini.php file looks like this (relevant section) -

[database]
host =
username =
password =
dbname =
tables_prefix =
port = 3306
adapter = PDO\MYSQL
type = InnoDB
schema = Mysql

The config.ini.php file has the correct username & password configured in it. Is is usual for the global file not to list them?

The file piwik/config/global.ini.php is shipped with Piwik, don’t try to edit or will be overwritten on next update. You must copy variables from there and set your custom configs inside piwik/config/config.ini.php

If you want more informations about your php installation ask your hosting provider or you can build a new file, for example info.php having this content:

<?php phpinfo();

Remember to delete it after public usage because of security issues: phpinfo() manual page

The meaning is: look for mysql stuff inside your php configuration to find correct usage. This is an overview of mysql drivers inside php

Did you manage to fix this? Same thing hapenning to me today.

I have not. My hosting provider (Bluehost) does not provide a way for me to apply changes I make to the config files so I decided to just do a reinstall. When I got to the installation checklist, I have a critical error stating

Required PHP configuration (php.ini) - always_populate_raw_post_data=-1
To prevent some critical issue, you must set the following in your php.ini file: always_populate_raw_post_data=-1
After making this change, restart your web server.

Which again, I cannot do as I can’t apply changes to my php.ini file. I need to contact my hosting provider about this but it’s low priority for me right now.

Edit: Fixed typo. Also, see my reply below (Error: MySQL Driver not Installed - #9 by MRPockets) regarding applying changes on Bluehost.

Thanks for the reply. I have no idea what happened to cause this to stop working. Was there a change at your provider end? I’m with JustHost. I didn’t make any account changes and certainly not any config or ini file changes.

As far as I can tell, there was no change. I manage a separate Bluehost account where I have a Piwik instance installed & have had no problems; the account packages, while not identical, are both shared hosting plans with similar features & both were running Piwik instances at the time the first broke.

My best guess as to why I initially had issues is that it is related to the report generation/archiving; I had not logged in to the instance that broke in ~2 months and did not have a cron job set up. But as I don’t have a good grasp of the way the parts Piwik uses work, that’s just a partially-informed guess.

I have no idea why I can not perform a fresh install of Piwik on one account but have no issues on the other.

Today I was able to successfully reinstall Piwik. I am not sure how much of the following will be host dependent but hope it can help you.

After talking with support I I made the recommended changes using the code editor in CPanel->File Manger. (Note that before I made the changes via FTP & was unable to get the changes to apply.) After waiting for a few minutes, I was then able to complete the Piwik installation.

I suspect that using the code editor triggered a refresh of the php.ini file by the server that editing it via FTP did not.

Everything is now working as before.

For the changes in php.ini to be taken into account, the web server has to be restarted.

I don’t know how, but as I said, the Piwik installation errorred out until I made the suggested change via the code editor. I did not restart the server (to the best of my knowledge, my account doesn’t have the authority to restart it) but after waiting a few minutes, the installation succeeded. Maybe the code editor triggered a restart, but I don’t know enough about shared hosting to know if that is likely/possible.

Hi! Did you get any error when you first installed piwik?? I do have bluehost and cant install piwik, tried with one click install, tried manual install and nothing works. :frowning2: I get this error:

To prevent some critical issue, you must set the following in your php.ini file: always_populate_raw_post_data=-1
After making this change, restart your web server.

Yes, I got that error when I did a fresh install on my Bluehost account. To fix it, go to CPanel and open the File Manager. Navigate to wherever your Piwik instance is installed and find the php.ini file. Select it and then click on “Code Editor” in the toolbar at the top. When it opens, find always_populate_raw_post_data= and change the value to -1.