How to create backup files from Mysql database
Daisho Komiyama edited this page Apr 2, 2019
·
1 revision
Today I created a backup file from Mysql for my blog: Quebec3
- Login to your server using ssh:
ssh [user_name]@[your_server_ip_address]
- After login to your server, use this command to login to Mysql:
mysql -uroot -p
- Display databases to check the database name you want to export
show databases;
- Exit Mysql by entering
exit
- The syntax for using the mysqldump command for exporting a database is:
mysqldump -u [user_name] -p [database_name] > [backup_file_name].sql
- Then you'll get
[backup_file_name].sql
in your home directory
- In your local machine, navigate to where you want to download the backup file
- Then type this command:
scp root@[server_ip_address]:[backup_file_name].sql .
Done! Don't forget to delete the original backup file in your server.