Command Line mysqldump and restore

Using the command line prompt to backup and restore a database can be quicker using the command line.

mysqldump -u [username] -p  [database_name] > backup_file.sql

If you get an error message about tablespaces, use the following command

mysqldump --no-tablespaces -u [username] -p  [database_name] > backup_file.sql

To restore the SQL file dump use the following command:

mysql -u [username] -p [database_name] < backup_file.sql

For any of these commands, you will be prompted for the password for the database after issuing these commands.

Scroll to Top