Cisco Documentation > Knowledgebase > Data Base Backup > Database Backup
Database Backup
Step 1 - Backup the Source Database
- First create a backup of the database on the source server.
mysqldump -u root -p --opt databasename > databasename.sql
- Once the dump is completed and ready, transfer the dump to destination server
Step 2 - Transfer database dump to destination server
We use SFTP to copy the database file between Ubuntu servers. You can also use SCP instead.
- The steps to connect to destination server using sftp and transferring the dump file is as following.
- Navigate to the directory where the mysqldump file is stored.
sftp user@destinationserver
(replace this with your destination servers user name and IP or domain)
sftp> cd target/directory
(navigate to the destination servers directory where you want to copy the file to)
- sftp> put databasename.sql (use the file name to transfer single file, or the command below to copy all files from source directory)
- sftp> put *
Step 3 - Import MySQL database dump
Once the data transfer is complete, import the database dump into the new MySQL server.
mysql -u root -p databasename < /target/directory/databasename.sql
Review this page