I had a situation recently where I had a fully operational website running on the web and I needed / wanted to make some radical changes to the theme and I wanted to interact with the current database. I use wamp for a local test server and wanted to replicate the entire website to my local machine. It took a little stuffing around so I have made a short list to help others out wanting to do the same or in case I forget and need to remember how.
Get the latest version of WordPress from wordpress.org
Unzip the package and add it to the www directory in wamp.
Run the activation of WordPress from scratch to make the database and config.php page. Check http://localhost/yoursite/
Assuming it is all working locally we can now start to make the conversion. Copy the entire wp-content directory from your working site into your local site files (e.g Delete the local wp-content and replace it with the website version)
Open up phpMyAdmin for your live site. Your hosting provider should give you access to this through cpanel or something similar. Open the database that relates to your live site and then click on the Export tab at the top of the page. The default settings are usually fine. Just make sure that you are exporting and sql file. Save it to your desktop where you can easily locate it later. This may take a while depending on the amount of data you have stored.
Open phpMyAdmin for your local wamp server. The green W in system tools will allow you to do this quickly. Open the new database that you just created in Step Two. Click on the Structure tab at the top of the page and all the tables within your database will then be displayed. Select all the tables withthe select all link at the bottom or click on each checkbox. Use the drop down menu at the bottom of the tables and select drop. This will delete all the tables that you have in your database on the local server. NOTE: Ensure you are dropping the localhost tables not your live site ones.
When your live database download has finished check the size of the file. If it is over 2 megabytes you will have to zip the file in order to allow phpMyAdmin to upload the data. Zip it with you favourite zipping program. If it is still over 2 mb after zipping you will have to make changes to the post_max_size = 8M
upload_max_filesize = 2M
in the php.ini file within wamp. Just ensure that the post_max_size is larger or the same as the upload_max_filesize.
In your local phpMyAdmin while still in the database that you created and have just deleted the files from import the new database information. Click on the import tab and select the sql file or zip file and click on go.
If all went well you will have a whole new set of tables in your new database. In order to be able to access the localhost now click on the wp-options table. The fist entry in the table should be siteurl under the heading of option name. Click on the pencil to edit this. Change the http://yoursite.com to http://localhost/yoursite.
Go to http:/localhost/yoursite/wp-admin/ and log in the same as you would in your live site. When you reach the dashboard check the address bar of the browser to ensure you are in the right site. Go to Settings>General in the dashboard area. Change ‘site address url’ to the same as ‘WordPress Address URL’ e.g. http:/localhost/yoursite.
Check the front end to see if everything is working ok. If you have changed how your permalinks work you may not be able to view pages or posts etc. Go to Settings>Permalinks and select ‘default’ which should rectify any problems.
That is it hope it helps.0 Be the first to like this.