SnapShooter Backups Server, Database, Application and Laravel Backups - Get fully protected with SnapShooter

Backup and restore MySQL database from command line

You can backup and restore your MySQL database using a GUI wizard. However when you are in a slow network environment, doing the backup and restore are still the best option. In both ways, you must ensure that you have the required permissions, access rights, and enough free space on your system. If you need to restore your MySQL database, it is best to backup the entire database.

Backup database from command line

mysqldump -u your-database-username -p --databases your-database-wish-to-backup > backuped-db.sql

Update the following variables to your own:

  • your-database-username: the database username.s
  • your-database-wish-to-backup: the database you wish to backup.

Restore database from command line

mysql -u your-database-username -p your-database-wish-to-retore-to < backuped-db.sql
  • your-database-username: the database username.
  • your-database-wish-to-retore-to: the database you wish to backup to.