Import a MySQL database on the command line
If you’ve ever tried to use phpMyAdmin to import a large sql database, then you’ve no doubt had fun slicing the file into smaller parts, or changing apache’s request timeout, or …etc…
There’s an easier, and faster way. Just upload the sql file to your server and use mysql from the command line to import the data. It’s as simple as issuing the following command:
mysql -u USER -p DBNAME < dump.sql
Where USER is your MySQL username and DBNAME is the name of the database you’d like to import into. After hitting enter, you’ll be asked for the password. Enter it and away you go.
