Backup with mysqldump

Use the mysqldump program from the command line (outside of MySQL monitor).

 

The mysqldump program requires the user name and password (no space after the -p) followed by the database to backup, which is then redirected using > to your preferred target filename, preferably with the .sql extension:

d@workstation:~$ mysqldump -u root -pSecret Academy > myBackup.sql

 

Use the --databases option to backup multiple specified databases:

d@workstation:~$ mysqldump -u root -pSecret --databases Academy phpmyadmin > myBackup.sql

*Note: use of double - before --databases

 

 

Use the --all-databases options to backup all the databases:

d@workstation:~$ mysqldump -u root -pSecret --all-databases > myBackup.sql

*Note: use of double - before --all-databases

 

 

To backup just a specific table, specify the database name followed by the table name:

d@workstation:~$ mysqldump -u root -pSecret Academy Students > myBackup.sql

Leave a Reply