Hello there, welcome to the third part of my tutorial – Migrating WordPress site from one server to another.

In this part of the tutorial I will show you how to upload your downloaded site to the new server. This applies to the moving of the WordPress site  from some free hosting, or your local machine, or any other case where domain change is involved. If you are just changing your hosting provider but keeping the same domain, this includes domain redirects and is not covered in this tutorial, but will be covered in the one dedicated to this kind of problem.

Now, let’s continue where we left off. After you have downloaded your site to your machine, along with it’s soul (database) – you need to upload it to the new server. But before we proceed to the action, just like in the first part of the tutorial, there are some necessary preparations that have to be done.

Creating New Database And Assigning New User To It

biz.nf

Free Hosting

Log in to your new cPanel and find Database Manager option:

migrate_wp_site

 

This will lead you to the new window:

mysqldatabase

Here under the Create MySQL Database  section you need to give your database a name and a password. You should write this information down because you’re going to use it later in the process.  When done hit Create Database button. Your new database will be created in few moments (I mean seconds). What is interesting to note here is that in this example new user will be automatically created and assigned to your new database, while on other examples you will be required to that manually.

Now collect the new user information and add it to the ones already written (database name and password). You will have all the info bellow:

downloadwpsite

Copy and paste the user id (below the User tab) to the text editor where you have already added Database name and password. Then add to that Host information found under the Host tab. That all you need from here. Save all that and then proceed to the next step Editing the wp-config File. If you want to check other two examples which I’m encouraging you to do, go on with the reading so you can compare three different cPanels and lower the chance of failure. Other way click on the link and skip to the next part.

hostinger.co.uk

Free Hosting

Log In to your cPanel and find MySQL Databases option:

migrate_wp_siteH3

 

This will open new window whit some fields you need to fill:

migrate_wp_siteH4

Here need to give your new database name and password and assign it a user (MySQL Username). Fill that and write it down somewhere, or copy and paste it to the notepad (which you should save somewhere) because you will need these information later and in some future maybe.

As you can see it is similar to the example above, but the difference is that in this cPanel you need to create user yourself. In the next example I will show you more complex approach in case your cPanel requires it. If you do not want to read it, you can skip it by clicking the link : Editing the wp-config File.

contrateam.com

Paid Hosting

Log In to your cPanel and click on the MySQL Databases option.

mysqldatabase2

New window will be opened with an empty field in which you need to enter you new database name:

migrate_wp_site45

 

After naming your new database hit Create Database button. Your new database should appear below:.

migrate_wp_site46

 

Now you need to create new user and assign it to this newly created database. Scroll down a little and under Add a New User section fill in the necessary information :

migrate_wp_site47

Give your user a name and a password. These information will be used later so make sure to write it down. When done, hit the Create a User  button.

Now you need to assign that user to the created database. You will do this by scrolling down a little more to the Add a User to a Database section.

migrate_wp_site48

 

Here you need to select a user and add it to a database. Do this using the drop-down fields (in case that this is your first database and user, they will be selected automatically as they are the only results available to show). Now write down all these information: database name, database user, database password and database host. If you cannot find your database host in the available information it is very possible that it is localhost  but you should contact your hosting provider just to be sure. Remember this is important piece of information.

And that’s it! You are almost done. Now you can proceed to the next step.

 

Editing The wp-config File

Now you need to go to the folder on your local machine to which you have downloaded your site. Find the wp-config.php  file, right-click on it, select Open with and then Notepad.

editwp_config

 

In this file (after you have opened it) you need to edit four things:

  • DB_NAME
  • DB_USER
  • DB_PASSWORD
  • DB_HOST

editwp-config2

 

Now let’s analyze all the lines you need to edit here:

  • define(‘DB_NAME’,  ‘nekretn’) – here you need to enter your new database name assigned in the creation process done in the previous step. In case you get confused you should enter your new database name as the second parameter (in this example it is ‘nekretn’ <– change this parameter). In your example it will be some other name.
  • define(‘DB_USER’,  ‘root’) – here you need to enter your database user created in previous step.  Also, this should be entered as the second parameter (in this example instead of ‘root’), but again in your example it will be something different.
  • define(‘DB_PASSWORD’,  ‘ ‘) – here you need to put your database password . Note: as seen in previous step in some examples  instead of database password you would enter user password, anyway this is the field for it. In this case it is an empty field but in your case it will be your old database password. Replace it.
  • define(‘DB_HOST’,  ‘localost’) – Here you need to enter new database host . It is the last parameter from your MySQL Databases section that you wrote down after the new database creation (I told you to write everything down). Place it as second argument between the parentheses . In this case it is ‘localhost’.

Important

Pay attention not to delete parentheses ‘  ‘  – every parameter must  be entered between the parentheses. If you delete one, or both your site won’t work until you wrap that parameter  with the parentheses again.

Database above was hosted with the Wamp Server, so in case you are migrating from the localhost using any of these local servers (wamp or xamp) you will get same parameters in your database (‘root’ as a user, ‘  ‘- empty passsword and ‘localhost’ as a database host)

Editing Your Site’s Database

Now lets make the final preparation. Go to the downloads folder and locate your downloaded database (you did this at Download Your Database part of the tutorial, in case you skipped it, now is the time to visit it).

migrate_wp_site25

 

  1. Right-click on your database. Select Open from the drop-down menu
  2. Choose Select a program from a list of installed programs
  3. Select Notepad and click OK

This will open a database in notepad:

migrate_wp_site26

Here you need to delete following lines that are marked in the picture above:

–CREATE DATABASE  ‘1571874_C559’ DEFAULT CHARACTER  SET latin1 COLLATE latin1_sweedinsh_ci; USE  ‘1571874_C559’; —

This line of code is an SQL command that is executed when you import this database to the new one. This is most often reason for errors, so to reduce the chance of getting an error, let’s delete it.

Importing The Database

And now you are almost there. Before the final step, you need to import your database to the new server. So go log in to your cPanel and then eneter the phpMyAdmin option.

migrate_wp_site44

This part (entering phpMyAdmin) was already described in the download (Back Up) Your Database part. Difference is that now you are entering to the phpMyAdmin of your new cPanel

Here you should see the database you previously created. Along the missing information about your database host (in case you could’t find it in the MySQL Databses section)

uploaddatabase

And now the finishing step before you can access your site.

Changing Your Website URL

From here (phpMyAdmin dashboard) click on the newly created database (illustrated on the picture above).

Note

In my example I named my database umetnick_demo   in your case it will be named the way you decided in previous steps when you were creating this database.

After you click on it, you should see following result:

importdatabase

 

Here click on the Import button

importdatabase2

And select your database from where it is located on your hard. After that hit the Go button, and you are done! One more little thing and whole process is finished. If you have done everything right you should get success message and on the left you should see your wordpress site’s database tables being populated.

importdatabase3

And now the final step – go to the wp_options table located on the left.

importdatabase4

New tables will be populated in the main screen. What you need to do here is to click on the first one under the option_id it is indexed as number and under option_name table as siteurl. This is a table that holds your website url and unless you change it here it is going to lookup for your site on the previous address.

Click on the edit (marked in the above illustration):

importdatabase5

Here you will see your previous url address (used for accessing your site). Just edit it replacing it with the actual URL address, and you have finished this process!

Go to your browser now, and test it, if everything done right your site should be on it’s new location 🙂