Backup and restore a mysql database from command line

Because we all love SSH, here is a little reminder of how to backup a MySQL database from command line.

This is to know !

It will simple dump all database tables into a file called database-name-backup.sql using login mysqlLogin and the given password.

I made a simple bash script that creates a backup file, so no need to remember that command line :

 

To restore it, it’s pretty simple :

 

Published by

Louwii

Web developer, geek, car enthusiast, photographer, DIYer, video gamer... I like many things, maybe too many?

Leave a Reply

Your email address will not be published. Required fields are marked *