Dumping a database export to file in Linux

Backing up MySQL databases is easy. You can do this database export in linux with the mysqldump command line as follows;

mybox: # mysqldump -u root -p databasesource > mydatabase-backup-27-aug-2015.sql

(where databasesource is the database you want to export)

Of course, after you have dumped the SQL database you want to export you may need to import it back into the machine or a new server that you are migrating to. This is also easy to do;

mybox: #mysql -u root -p databasetarget < mydatabase-backup-27-aug-2015.sql

(where databasetarget is the database you wish to import to)

 

Leave a Reply

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