Sometimes you need to dump a MySQL database so it can be restored on the same server or moved somewhere else. mysqldump is one of the quickest ways to do that from the command line.
Backup
| |
Replace user, password, and database_name with your own values.
One important detail: do not add spaces after -u or -p.
Restore
| |
This restores the SQL dump back into the target database.
It is a simple workflow, but it is still one of the most useful command-line habits to know when working with MySQL.