I been getting asked, How can I load my MySQL database from the command line?

So I am going to make this quick and easy…

First cd in the folder where your sql file is, for this demo I am using a file called “backup.mysql”. Then use the following command

mysql --user root --password regandb < backup.mysql

MySQL will prompt you for a password then your mysql will be loaded depending on how big your backup/file is it may take some time. You could add a -f flag if your database is very big, it will prevent it from stopping if there is error.

ITS THAT EASY!!! :)

If you have any questions or comments please email me at john@johnathanmarksmith.com



Published

03 May 2013

Tags