Friday, May 11, 2012

Installing Wordpress on Windows Using Remote Database Server

I got Wordpress installed on a Windows Server following the instruction in the post: Installing Wordpress on Windows.

My Wordpress site is on a Virtual Machine while the database server is on a physical machine connected via a private LAN.   Since the mySQL database server is one another machine, I have to choose Remote Database option for the installation.

The installation when fine but when I access the site, I  got an error message saying it couldn't login to the database.  I checked the database and I can see the database has been created and the user has permission but the thing is, the user permission wasn't properly setup.  The scope has been limited to "localhost" and as the result the connection from the VM got denied.

Easy fix, I thought.  I proceed to change the scope to the grant access from remote machine.  But that didn't help either.  My next action was to check the database itself and I can see that it has already been created.  Looking into the tables, I see none.  So apparently, during the installation, the root password was asked but the installer did not use it to create tables and instead, the wordpress user account is used to create them instead and since remote connection wasn't allowed, it couldn't login to create the table so the database is empty.

Bottom line is changing the scope to allow for remote connection on the wordpressuser account don't work.  I tried creating the user before the installation, but that didn't work either since a new one with the same scope showed up and ruin the party.

So I decided to use the root account/password to install it instead of creating a new user and things went well.  My site was up and running in less than 30 seconds.  But now my site is running with the root password which didn't sound good.

Poking around in the wordpress folder, I found a file called wp-config.php.  This file contains the database settings among other things.  I locate the database user, get rid of the root user and replace it with the one I created for the site.

Now I got Wordpress running on a less privileged account.  If you are having issue installing Wordpress on Windows using a remote database server, I hope this blog helps you.

No comments: