Ubuntu: Import a SQL Dump into MySQL CodeUnit 09 JAN 2011

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 mydatabase < 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 serve (Note the lack of space between -p and the password). Finally "mydatabase" should be replaced with the name of the database to effect.


Related Posts:

About Craig Lotter

South African software architect and developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.

  • Rayyan

    thank you..
    this is very helpful.