How to move a MySQL database to an external server
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.
Click on the name of your database in the left column.
On the new page click on export.
Leave the settings as they are and click on Go.
Now, a code will appear in the browser, or a file is downloaded to your computer. In the second case, open the file.
Copy the code from the place where the providers information ends.
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.
Click Go (lower right).
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.