Search Keyword:

01Sep

Importing large SQL files through command line when using PHPMyAdmin/XAMPP

Posted by admin as Others, PHP

This tutorial is on how to import large SQL files when your sql dump file cannot be handled by PHPMyAdmin due to its large file size. Importing large SQL file sizes in PHPMyAdmin will produce an error if maximum file upload size has been reached and sometimes may cause the browser to freeze. You have to import this through the command line.

Here are the simple steps on how to do it.

1. First, let us say that my Mysql.exe is in D:\xampp\mysql\mysql.exe (I’m using XAMPP by the way) . I’m gonna put my large SQL file in that directory also, meaning the path for the SQL file will be D:\xampp\mysql\your_sql_file.sql

2. Create your database in your PhpMyAdmin interface(database name only).

3. Run your command prompt(Start -> Run -> then type “cmd”).

4. Type this in the command line, assuming that your MySQL installation and the SQL file locations are on the paths I had given in Step 1.

D:\xampp\mysql\mysql.exe -u root -p db_name < D:\xampp\mysql\your_sql_file.sql

where “root” is the username of your database and “db_name” is your database name. After the successful command, you will be asked to enter password, enter your password if it has then press Enter or just press Enter if none.

5. Go back to your PHPMyAdmin to check of the SQL dump file has been executed properly.

  • Digg
  • del.icio.us
  • Tumblr
  • StumbleUpon
  • Technorati
  • Reddit
  • NewsVine
  • Slashdot
  • DZone
  • Facebook
  • Twitter

Comment Form

Sponsored Links



Recent Comments

  • Alex13: Hi! thanks for this great post and code. I found a problem with it and need your help: I have in my form an...
  • Krishnakiran: Do anyone have a sample code for this
  • Paul: Nice, that is exactly what I was looking for, thanks!
  • Czek: can i use this with php uploads? my server does not support APC or Pecl upload progress..i need to provide user...
  • anup: thanx it helped me alot…