Part 3 of How To’s with Hostgator
So you are looking for a new host cause lets face it your current one sucks, and you have decided that Hostgator is where you want to go. Now you are wondering how you get your site moved on over. Well the easy answer is if you only are moving one site, let Hostgator do it for you If you have more than one then you are on your own, but relax it is pretty easy. First what is involved with moving a site? Well a regular ole html site it would be just a matter of downloading you files from the old server and uploading to the new server. With wordpress though it takes a little more work. The way wordpress works is it has regular files on the server as well which you will do the old fashion way, but it also stores most of the information about the site in a database which also needs to be moved. What we will cover here is if you are moving your site as is from your old host to hostgator, i.e. from your root directory of the old host to the root directory of the new. Not moving it to a new directory as well, that gets a little tricker.
Moving Your Files
This is perhaps the easiest part. If you have moved files around your computer you can do this. Now before you do this you must first set up the domain in your new hostgator account. To review how to do this please see the previous post Setting up your WordPress Site on Hostgator. Ok for this process you will need a ftp program, if you are on a Mac (why wouldn’t you be) I can recommend Transmit (not an affiliate link). We will not go into how to set up your ftp program I’m going have to assume that you know or can learn to keep this post from being a novel. With your ftp program its as simple as logging it into your existing host and finding the root folder of your site. If its a straight wordpress install you should see about 35 or so files and folders with the majority of them beginning with wp-. You are going to download all of these to your computer, best idea is create a folder with the name of your site on your computer and put them all in there.
After that is complete you will log out then log into your hostgator domain that you set up. Now since you most likely havent moved your domain name yet (or you wouldnt be able to log into your current host) you will be logging in using your hostgator ip address and log in you created when you set up your domain. You can find the ip address in your hostgator cpanel in the bottom left ‘account information’ box. Log in and now you will upload all those files to the server. Once there you are done with phase one.
Exporting Your Database
As mentioned you first need to move your database and for that you do need access to mySQL at your current host with a tool called phpMyAdmin. This allows you to get down and dirty with your databases. When you run it you should see something like the screen shot below showing you your databases on the right and menu across the top.
You next would want to click on the database you are looking to move. If yo do not know the name of the database your site is using you can look in the config file. You should have it on your computer now after the download above, look for wp-config.php and open it with a text editor. Scan down a few lines and look for the line:
The _##### is your database name, the prefix is assigned by the new host when you create the new database so ignore it for now. You may also want to take note of the DB_USER and the DB_PASSWORD so you can duplicate it if you wish in the new databas but chances are you will have to edit these in the config file anyway as your prefix will be different.
After you have clicked your database the next screen is going to show you all the tables and data in there, can be intimidating but just ignore it all. On the menu above you will just click export. On the next screen you may have to click Custom – display all possible options so you can see all the options, you only need to find one. You will want to find the option add drop table and check it off
then click go or download. You now have your database on your computer, time for phase 3!
Creating and Importing New Database
Ok login to your hostgator cpanel and find the databas section on the right side and click the first icon mySQLdatabases. The very first thing you see on the screen is Create New Database with a text field for the name. Notice how it shoes the prefix that will be attached to the database name. You can make it the same it was before or a new name. Just take note of it for when we do the config file. After you click Create Database the next screen should show that it was created then click go back. Once back scroll down till you see mySQL Users, here you will enter a new user name. It can be the same as before or again you can enter a new one. Notice again the prefix, you will need it for the config file. Also enter and re-enter a password (no prefix here) then click Create User. Again once created click Go Back and scroll down. Last step here is to assign the user you created to the database. Using the two drop downs select the database and user you cread and click Add. In the next screen click the box for All Privileges then click on Make Changes. Your database is now created and you can now click the home button at the top.
Next we need to import the data from your old database up to this new one. In the database area you now click the icon for phpMyAdmin and once you see that screen again click on your new database on the left. Next screen is not so scary now because its an empty database, click on import so we can fill it. This is perhaps the easiest task, find the choose file button under file to import and use it to find the database you exported to your computer. Once selected just click go and wait. You are done!
If everything went smoothly then the next step is to edit your config file, the same one you peeked at above. You can do this on your computer using a text editor then upload it replacing the one up on the server, or if your ftp program allows it you can edit it on the server using your ftp program. You want to edit the following 3 lines with your information you created when creating the database. Dont forget the prefix on the first two, forgetting is often the cause of most errors
After this you can go to your domain registar and update the new name servers and wait for the change. You can check the site until by using a temp url of http://yourIPaddress/~cpanelusername/siteneame/. No there will be errors and missing content, dont let this scare you. Its because wordpress is using your domain name looking for things and its not there yet. As long as you see the structure of your site everything should be good once the domain name changes are updated and take effect.
Some may like to get all the info down from their current host, change the name servers then once the change is set then upload the files using just their domain name in the ftp instead of the ip address. This is ok if you are more comfortable this way but just know that your site will be down for a bit for visitors until it is up loaded.
See not that scary I have moved dozens of sites this way, when I moved to Hostgator and when I buy sites. Yes when you buy a site this is often how you get it. You will get a zip file with all the sites files and a database export. You would then go through the same process uploading it to your Hostgator account.
Hope this helps some of you and if you have questions let me know. I’m also available for a small fee to do the move for you if need be If this persuades you to finally open a hostgator account you can do so by clicking http://mymultiplestreams.com/hostgator This an affiliate link and I do earn a small commission if you do use it. I thank you in advance if you do!