Importing MySql dump through command line
Most of us webdevelopers are using databases. And when we start using live and dev versions we often use dumps to get back in sync. My database dumps started to become big in size (over 75mb). Importing through my local phpMyAdmin was cumbursome, without changing the upload size in the ini, so I wanted to start using the command line to import my dumps. This is targeted to Windows machines.
After a bit of searching and a lot of trying I found it. Use this on your command line.
[reference mysql.exe] [-h [host]] -u [user] -p -D [db] < [file]
Press WIN+R and open the DOS command by typing cmd. Then follow enter the string above with all the markup replaced.
There is a .exe file in the mysql/bin directory or do a search for mysql.exe.
For most people in a local environment this would be something like localhost. It is the same as the host you use for login in to you mysql environment. The host is not necessary but can be used when certain rights are set to it.
Specify the user name that you use to login to the databse. The -p is the argument that make sure you can give a password after hitting enter.
In the db you specify to what db you want to import.
The < before file specifies that you want to import the file into the database. If you use > instead it will dump the database to the file. The [file] is replaced by a full path to the .sql file that you want to import.