Ubuntu: Import a SQL Dump into MySQL

The quickest way to import a properly generated SQL dump containing structure and table definitions plus data into a MySQL database is to simply pipe the file directly to the powerful mysql command function via a terminal window.

The command would look something like this:

mysql --verbose -u username -ppassword < sqldump.sql

Although the –verbose switch is technically not needed, it does make it easier to follow the progress of the resulting import. The -u and -p switches indicates the account with which to access the MySQL server. (Note the lack of space between -p and the password).

Nifty.

You might also enjoy:

About Craig Lotter

Craig Lotter is an established web developer and application programmer, with strong creative urges (which keep bursting out at the most inopportune moments) and a seemingly insatiable need to love all things animated. Living in the beautiful coastal town of Gordon's Bay in South Africa, he games, develops, takes in animated fare, trains under the Funakoshi karate style and for the most part, simply enjoys life with his amazing wife and daughter. Oh, and he draws ever now and then too.
This entry was posted in MySQL, Ubuntu and tagged import, , restore, , , . Bookmark the permalink.
    blog comments powered by Disqus