Skip to content

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

Step 1: Check my database

  • 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

Step 2: Exporting my database

  • 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

Step 3: Download the backup file

  • 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.

Clone this wiki locally