WordPress Dev Environment Migration

I’ve tried looking around for a guide on moving a wordpress site into a dev environment, but all of the guides I’ve seen have been about CREATING one, as opposed to my situation, where I need to move an existin site to a local VM to create a dev/testing environment.

I’m fairly well-versed on how to create a dev environment from a regular old website, but just about everything wordpress-related gets me confused somehow.

Read More

Where I am now:
I’ve created a CentOS 6.0 VM using VMware on a Windows 7 machine. I’ve installed PHP, Apache, MySQL, and FTP-Server, along with all of the required updates and such. I have disabled SELinux.

I’ve moved the contents of the var/www/html/ folder from the live (production) server over to the var/www/html/ folder on my VM (currently exists within /var/www/html/my-website/)

My current issue:
When I attempt to access localhost/my-website/ I’m getting “Error establishing a database connection”. An attempt at localhost/my-website/wp-admin/ tells me that either the database server is down (do I have to start this separately?) or that the username and/or password information in wp-config.php is incorrect (this was all simply moved from one place to another).

Any assistance would be greatly appreciated.

Related posts

Leave a Reply

3 comments

  1. Have you updated wp-config.php to include your localhost and database info for your local dev environment?

    I bet wp-config.php is still pointing to your remote server DB which the MySQL DB wont allow for external connections

  2. Also, make sure that the dev is using the same domain as the live version. On my windows machine, I do this by changing my hosts file. I’m sure there is something similar on your VM.

    If I am unable to do this and I need the dev version to be under a different domain I would do the following.

    1. Create mysqldump of live database
    2. Edit the dump and replace
      all occurrences of livedomain.com with devdomain.com (if you dont do
      this at least check the wp_options table for the livedomain.com
      occurences.
    3. Change wp-config.php database settings.

    I always ensure to use the same domain (controlled by local hosts file), and same db config in my dev environment as in my live environment.

    If you’ve not changed the wp_options table for (option_name = siteurl or option_name = home), then chances are if you type in devdomain.com into your browser it will redirect to newdomain.com

    Hope this helps

    Blake

  3. I know this was been answered but just to be perfectly clear:

    on Centos6 you need to run httpd with php, and the mysql server. In the mysql server you have to import the database dump from the live website then you have to edit the config in wordpress to match the username and password on wordpress.

    now when moved the db does not keep the username and password so I suggest you do this
    commands to be run in shell:
    service mysqld start
    chkconfig mysqld on

    that will take care of the db server running

    then edit wp-config with username root and no password (I am pretty sure you have not added a password at mysql-server install)

    post in here if you need further help.