Import sql file from mysql command line by using PuTTY emulator

By | September 16, 2013

Hey there,

By Using phpMyAdmin, The sql file import operations for bigger files are very difficult. There is a chance that it’ll timeout during the operations and also, browser will be using heavy memory. So how to get rid of these issues?
No problems! Just try importing the sql file directly in mysql console (command line). I’m explaining the steps based on a web hosting context. (For eg. You’ve a hosting account (Shared or Dedicated) with GoDaddy, Bluehost, Hostgator etc)


  • Login into your server using PuTTY
  • login into mysql console
mysql -uUsername -hHostname -pPassword

(This is the command for directly logging into the mysql server. Please note that there is no space after -u, -h, -p. Also Replace Username, Hostname & Password with your DB details)

  • Choose your database for import operation
use DBname;

Replace DBname with your own database name

  • Import operation
source /var/hroot/home/contents/07/2342341/fhtml/sql/yourSql.sql

The import operation initiates once you execute the above command. We used source command to specify the location of your sql file (You’ve to give correct path of the sql file). That’s it.



Leave a Reply

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