mysqldump -u root -p --opt [database name] > [database name].sqlAfter performing the dump, you are ready to transfer the database. Step 2 – Copy the databaseSCP helps you copy the database. If you use the previous command, the database will be exported to the home folder. The SCP command has the following syntax:
scp [database name].sql [username]@[servername]:path/to/database/A sample transfer may look like this:
scp newdatabase.sql user@example.com:~/After connecting, 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 With that, your transfer via SCP will be complete. By Etel SverdlovIn this way, your transfer via SCP will be complete.
The above is the detailed content of How to migrate MySQL database in Linux system. For more information, please follow other related articles on the PHP Chinese website!