How to move a MySQL database to an external server

10.26.2012 by Ilia Raiskin

You may know it: you are not satisfied with your web provider or you want to switch from shared hosting to a dedicated server, and with the domain and the webspace it works quite well. Today, most providers offer easy ways for a domain transfer. But then the problem comes: At the old provider you have created one or more databases. And how do we get the entire content of the databases to the new server? Copying and pasting is too effortful. In this tutorial we're going to move separate databases (or rather, their content) to the new server. At first we want to mention that there are some similar tutorials on the internet, but these are often complicated and hard to understand for people who don't now much about SQL and terminal. Our variant is easy to implement.

Important: it is best to create a database on the new server/host before starting with this tutorial (It is advisable to use the same name as the old one).

First, log in to your provider (control center) and then go to the database-management-center: in our case it is phpMyAdmin.

move db 1

Click on the name of your database in the left column.

move db 2

On the new page click on export.

move db 3

Leave the settings as they are and click on Go.

move db 4

Now, a code will appear in the browser, or a file is downloaded to your computer. In the second case, open the file.

move db 5

Copy the code from the place where the providers information ends.

move db 6

It is helpful if you have previously created a new database on the new server (if not, then create one). Now log in there and click on the database name in the left column. Click on the menu-link SQL, and paste your code in the box.

move db 7

Click Go (lower right).

move db 7

After a short waiting period everything will be added and your new database will have the same structure and the same content as the old one! Now you only need to delete the old database, and change the data of the database connection in your programs. These data are: host, database name, username and password. Note that if you didn't create a database with the same name as the old one, you will have to change that in your database-connection-scripts too.

Side note for CMS

In Content Management Systems like Drupal, you can change the accessing-data in the settings.

About the author

Ilia Raiskin

Ilia Raiskin is a web designer, web developer, blogger and founder of