Import SQL data to MySQL database via console

Today I had to import a large amount of SQL data into an existing database.

In detail I needed to import the latest ip2nation data into my wordpress database. Because the file has a lot of records managing the import via the phpMyAdmin GUI leads to timeouts. So I had to do the import via SSH console.

Here are the few steps that were needed to do this using just the console click to investigate.

Download the current database:

cd ~

Unzip the SQL code:


Execute the SQL and import the data using MySQL user “root”:

mysql -u root -p mywordpressdatabase < ip2nation.sql

After entering the password import of the data begins and (hopefully) finishes after some time.

Tagged with: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *