[Solved] Phpmyadmin Vs commandline mysql import

Phpmyadmin allows GUI interface to import but it also depends on the browser because it runs on localhost, that is webserver so when importing huge amount of data the GUI of phpmyadmin seems to freeze, that browser stops responding.

  • If the file is of small size say around 10-20 MB it wouldn’t make any difference but if the file is of huge i.e. around 100+ MB, at that time it makes difference

As a solutions, we can increase the filesize import limit and execution time limit through php.ini.

And the other solution would be to use the mysql command line to import that is very efficient compared to the GUI for import i.e. in phpmyadmin.

The command is

$ mysql -u root -p -h localhost -D "databasename" < import.sql

Then you’ll be asked for password of mysql, supply your mysql password and wait for few seconds/minutes. The amount of time one has to wait depends on the amount of data which is being dumped. The higher the amount of data means higher the waiting time.

When your data has been successfully dumped you will get a command prompt, without any error messages, which means the data has been successfully dumped.

Above command works for both Windows as well as Linux. I have tried importing the 150 MB of file and it took me around 10 sec.

Hope this helps someone.

Samundra Shrestha

Fullstack Developer, Senior Software Engineer

Leave a Reply

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