This article describes how to manually dump a MySQL database and copy it to another server. Note that this article specifically covers non-user databases; refer to this article for how to dump and copy user databases:
- Access the source server via SSH as the root user.
- Dump the database with this command, replacing db with the name of the database to dump:
mysqldump db > db.sql
- Copy the database file to the destination server, replacing 203.0.113.21 with that server's IP address:
scp db.sql email@example.com:/root
- Access the destination server via SSH as the root user.
- Create the database in MySQL:
mysql -e 'create database db'
- Import the database file into MySQL:
mysql db < db.sql