MySQL database dump & restore

Putting this here as I keep having to google it (paranoid that I’d do something wrong and mess up the db more than anything else) and keep finding crap results.

[sourcecode]
mysqldump -u [username] -p [database_name] > dump.sql
# it then prompts for the password

mysql -u [username] -p [database_name] < dump.sql
# it then prompts for the password
[/sourcecode]

Leave a Reply

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