Restoring mysql from the command line

Restoring mysql from the command line

If you’re restoring a database from a file that’s over a few megabytes in data uploading the file directly to Mysql can stall. You can zip or tarball the file which may solve this however at some point you really just need to do the restore from the command line which is simple enough;

mysql -u username -pdatabase_name < /path/to/file/file.sql

Note: No space between the -p and password. ie: -ppassword