Tag Archives: import

How to use MySQL to Import a .sql file Tips, Tricks and Tutorials 05 JUL 2015

Quite often I like backing my databases up as .sql files, which then comes in handy for also moving databases around, or making copies of them. The question is, given your Ubuntu server and the mysql command, how do you import a .sql file?

Well first, you enter the mysql console in the usual manner:

mysql -u USERNAME -p

Once in, switch to the database that you want to run the SQL import against:

mysql> use DATABASE_NAME;

With the database changed, the next step is to actually do the SQL import itself:

mysql> source PATH/TO/FILE.sql;

Easy as that. Of course, you could just have done the whole thing via the terminal command line if you didn’t want to access the MySQL console in the first place:



importing goods on a container ship

Blogroll: How to Export and Import WordPress Blog Links CodeUnit 26 FEB 2011

To export and import a WordPress blogroll, or links if you prefer, is actually pretty easy, seeing as WordPress already comes with everything necessary for this built in.

Your WordPress blog’s links and links categories are accessible by hitting this URL:


Now that you know this, importing links from one WordPress blog to another becomes trivial. Simply browse down the wp-admin menu on the left until you find the Tools -> Import menu item. Clicking on the Import menu you will be presented with a number of different import choices. Select Blogroll (import links in OPML format).

The screen presented allows you an option of inserting an OPML URL, in other words the URL we used above. After inputting the URL and clicking import, voila, you will see a list of the imported links, ready for you to play around with to your heart’s content.


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.