X

Backup and Restore MySQL Databases on the shell

One way to create a backup of a MySQL database on the shell is to use the mysqldump command. Mysqldump creates a dump of the database in form of sql commands, which can be easily restored using the mysql command or PHPMyAdmin.

Backup a MySQL Database

mysqldump -u root -p mydatabase > /tmp/backup_mydatabase.sql

This command creates a backup of the database with the name "mydatabase" in the file /tmp/backup_mydatabase.sql

Restore a MySQL Database

To restore the backup, use the command:

mysql -u root -p mydatabase < /tmp/backup_mydatabase.sql
Tags: Linux & Unix
Till Brehm:
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings