1: Login to your hosted phpMyAdmin and export a copy of your database

Using 1&1 Web Hosting?

  1. 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.
  2. 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).
  3. Then click phpMyAdmin. You should now have phpMyAdmin open in a new tab or window in your browser.
  4. In the sidebar, click on the name of your database and you will see all of the database tables load.
  5. Now click Export in the header.
  6. 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.
  7. 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 😀

2: 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://theeasyweb.co » to the local host e.g. « http://localhost » (my hosted website lives at « https://theeasyweb.co » and my local version lives at « http://localhost »):

  1. Firstly, I look for all occurrences of https://theeasyweb.co and replace it with http://localhost.
  2. Replace all occurrences of http:\\/\\/etalented.co.uk with http:\\/\\/localhost.
  3. Replace all occurrences of "//etalented.localdev with "//localhost.
  4. Save the file when your done.

By the way, a good tool on Mac for doing this is TextMate.

3: Login to your local phpMyAdmin and import your database

MAMP

  1. If you are on Mac, and using MAMP, then visit http://localhost/phpmyadmin/.
  2. 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.
  3. 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.
  4. After a little loading, you should see a message saying ‘Import has been successfully finished’…and thats what we want 😀

4: Login to your hosted FTP and download a copy of your website

1&1 Web Hosting

  1. Again, with 1&1 web hostinglogin 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. Then hit Choose! You should now see all of your website files downloading…and that’s what we want 😀

5: 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.

Copy link