Home » Categories » Multiple Categories |
How To Migrate a MySQL Database Between Two Servers |
Article Number: 185 | Rating: Unrated | Last Updated: Tue, Sep 23, 2025 at 11:32 PM
|
Transferring a database between virtual private servers can be
accomplished using a SCP (Secure Copy), a method of copying files
derived from the SSH Shell. Keep in mind, you will need to know the
passwords for both virtual servers. In order to migrate the database, there are two steps: Step One—Perform a MySQL DumpBefore transferring the database file to the new VPS, we first need to back it up on the original virtual server by using the mysqldump command.mysqldump -u root -p --opt [database name] > [database name].sqlAfter the dump is performed, you are ready to transfer the database. Step Two—Copy the DatabaseSCP helps you copy the database. If you used the previous command, you exported your database to your home folder.The SCP command has the following syntax: scp [database name].sql [username]@[servername]:path/to/database/A sample transfer might look like this: scp newdatabase.sql [email protected]:~/After you connect, the database will be transferred to the new virtual private server. Step Three—Import the DatabaseOnce the data has been transferred to the new server, you can import the database into MySQL:mysql -u root -p newdatabase < /path/to/newdatabase.sqlWith that, your transfer via SCP will be complete. |
Attachments
![]()
There are no attachments for this article.
|
Upgrading Debian to Unstable
Viewed 3877 times since Thu, Dec 26, 2013
How To Use a Simple Bash Script To Restart Server Programs
Viewed 3474 times since Fri, Dec 27, 2013
How To Install (LEMP) nginx, MySQL, PHP stack on Arch Linux
Viewed 13898 times since Sun, Dec 29, 2013
How To Install an Upstream Version of Node.js on Ubuntu 12.04
Viewed 2851 times since Sun, Dec 29, 2013
How To Set Up an NFS Mount on Ubuntu 12.04
Viewed 10697 times since Tue, Dec 24, 2013
How To Copy Files With Rsync Over SSH
Viewed 6755 times since Fri, Dec 27, 2013
How To Install nginx on Ubuntu 12.04 LTS
Viewed 3020 times since Tue, Dec 24, 2013
How To Install Node.js with NVM (Node Version Manager) on Server
Viewed 4113 times since Sun, Dec 29, 2013
Intermediate Sed: Manipulating Streams of Text in a Linux Environment
Viewed 10312 times since Fri, Dec 27, 2013
Installing and Using the Vim Text Editor on a Cloud Server
Viewed 2827 times since Fri, Dec 27, 2013
|