Need some help creating a working copy of your remotely hosted WordPress website on your personal computer? Then I can help you!
Login to your hosted phpMyAdmin and export a copy of your database.
Using 1&1 Web Hosting?
- If you are with 1&1 web hosting (like me), login to your Control Panel, look for MySQL Database under Manage Webspace and this will take you to a list of databases that you have in your account.
- Find the relevant database for your account – the way I knew which database to choose was by looking for the value of the DB_NAME property in the wp_config.php file (more on that later).
- Then click phpMyAdmin. You should now have phpMyAdmin open in a new tab or window in your browser.
- In the sidebar, click on the name of your database and you will see all of the database tables load.
- Now click Export in the header.
- You will be given the choice of a Quick export or a Custom export – I prefer the latter as it allows me to set the following options: Disable foreign key checks, Add Create Database/Use statement. All other options are left as default.
- Then hit Go! And you should see your browser download a copy of your database as a SQL file…and that’s the result we want 😀
Modify your SQL file before import.
This is an important step that is often missed and forgotten. Basically, we need to replace all occurrences of the domain of our hosted website to the domain of our local website. So for me, when I do this I replace all occurrences of the remote host e.g. “https://etalented.co.uk” to the local host e.g. “http://localhost” (my hosted website lives at “https://etalented.co.uk” and my local version lives at “http://localhost”):
- Firstly, I look for all occurrences of
https://etalented.co.ukand replace it with
- Replace all occurrences of
- Replace all occurrences of
- Save the file when your done.
By the way, a good tool on Mac for doing this is TextMate.
Login to your local phpMyAdmin and import your database.
- If you are on Mac, and using MAMP, then visit http://localhost/phpmyadmin/.
- Click on Import in the header and click Choose file and locate the SQL file from earlier. Don’t worry about any other options – you can leave them as default.
- You can now hit Go! This will create the database for us as well as import all of the data for this database – by the way, I have assumed that you have not yet already done this and this is your first time doing this.
- After a little loading, you should see a message saying ‘Import has been successfully finished’…and thats what we want 😀
Login to your hosted FTP and download a copy of your website.
1&1 Web Hosting
- Again, with 1&1 web hosting, login to your Control Panel, and look for Secure FTP Account under Manage Webspace and this will take you to a list of FTP accounts for your account.
- You should have an account listed on this page that has a Personal Note of “Main user for SFTP and SSH” – this is the account we are interested in. The username is shown in the 1st column and if you do not know the password for this account you can reset it by clicking the 3 dots under More, Edit Settings and then clicking on Password.
- Under the list of accounts is the Connection Data that we need to put into our FTP software in order to establish a connection to 1&1 – on Mac, I like to use CyberDuck.
- Having established a connection, we then need to find our website files – I installed WordPress on 1&1 using the Click and Build tool and so I just need to open the “clickandbuilds” folder and Etalented is listed under there.
- Then, in CyberDuck, I right click on this folder, choose Download To – this will launch a Finder window in which you need to locate the “htdocs” folder of your MAMP install and the correct directory for the local version of your website.
- Then hit Choose! You should now see all of your website files downloading…and that’s what we want 😀
Connect your local website to your local database
Open up “wp_config.php” in your local website and change the value of “DB_USER” to a user that has access to your local database – for me I use “root” as do most as for a local database it is perfectly safe. Then, specify the password for this user in “DB_PASSWORD” – for MAMP the default password is “root”. For “DB_HOST” a value of “localhost” usually works. You should not need to change the value of “DB_NAME” as you should have created the database with the same name as the hosted database.
Your done 😀
You should now have a fully working local version of your website – load the URL of your local version and see if it works!
Are you having problems seeing the homepage of your local version? Then my other post about the homepage of a WordPress website downloads instead of loading in the browser may help you.