Understanding MySQL Errors when installing Web Apps in WebMatrix
A common issue that we’re seeing being reported by folks using WebMatrix is an inability to connect to a MySQL database when installing a PHP Web Application, usually with access denied. These error remains even if MySQL is uninstalled and then reinstalled.
This article details the most common scenario – that the admin password from a previous install is cached -- and shows how to fix it.
MySQL Error when installing a Web App with WebMatrix
When installing a PHP Web Application that uses MySQL like WordPress, Drupal or Joomla, you may see an error like this:
This occurs because you already have a MySQL database for which you don’t know the administrator password. Even if you uninstalled MySQL previously, your databases and administrator passwords are cached. This typically happens if you have previously installed an app using WebMatrix, and the app install downloaded and installed MySQL for you. At that point you configured an admin password for the MySQL Server. On subsequent app installs, even if MySQL has been uninstalled, the installer only asks you for the exisiting admin password. As the password was cached, WebMatrix doesn’t know that you’d previously uninstalled MySQL.
To get around this, do the following.
[[NOTE: This process is only to be used if you don’t mind deleting all your MySQL data. If you want to keep your data, you’ll have to reset your admin password, instead of deleting the cache. The process to do that can be found here: http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html#resetting-permissions-windows]]
1. Uninstall MySQL [[if it isn’t uninstalled already]]
2. Open Windows Explorer
3. In the Address bar of Windows Explorer, type C:\ProgramData. This is a hidden directory, and typing its location into the address bar is the easiest way to get to it.
4. In this directory you’ll see hidden cached files for a variety of applications, including MySQL
5. Delete the MySQL Folder
6. Launch WebMatrix and try to install another PHP/MySQL app, you’ll see that MySQL will now download and install, and you’ll get the dialog asking you to configure the admin password. Once this is done, your app will successfully install.