Import sql dump using the MySQL client

This is useful if you don’t have access to phpmyadmin on your server but have access to ssh and ftp. Or you have a huge sql dump like 10MB or higher that you cannot import directly on phpmyadmin. In my case the phpmyadmin directory was password protected by Apache and I don’t have the right password.

First upload the .sql file on your server using an FTP client and remember the path.

eg.
For Linux
/home/lopau/mydump.sql

for Windows
C:/wamp/www/lopau/mydump.sql

Login to your server using an SSH client like Putty.

On the command line access MySQL
$> mysql -u username -p password

replace username and password with yours.

On the MySQL client command line access and use your database.
$> use lopaudb;

Now to import your dump;
$> source /home/lopau/mydump.sql;

If successful you should see
Query OK, 13 rows affected (0.00 sec)

That easy.

One thought on “Import sql dump using the MySQL client

Leave a Reply

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