In this tutorial we’ll install the Debian Linux 9 (squeeze), Apache 2 with mpm-itk (to run each web as a isolated user),...
Moving databases from one MySql server to another
Ástþór IP1. On the source database server run the following command to export all databases:
mysqldump -h localhost -u {username} -p --all-databases > database_dump.sql
Replace {username} with your MySql username.
You can also export a single database using this command:
mysqldump -h localhost -u {username} -p {database} > database_dump.sql
Replace {username} with your MySql username and {database} with the database you are going to export.
2. Move the database_dump.sql file to your destination server. You could grab it from FTP server or put it on a public web location and use wget on the destination server to receive the file. This process it outside the scope of this tutorial.
3. Import the dump to the destination MySql server by running the following command:
mysql -h localhost -u {username} -p < database_dump.sql
Replace {username} with your MySql username.
If you are only exporting a single database, use this command instead:
mysql -h localhost -u {username} -p {database} < database_dump.sql
Replace {username} with your MySql username and {database} with the database you are going to export.