Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Import 1GB .sql file to WAMP/phpmyadmin

I want to import over 1GB size sql file to MySQL database in localhost WAMP/phpmyadmin. But phpmyadmin UI doesn't allow to import such big file.

What are the possible ways to do that such as any SQL query to import .sql file ?

Thanks

like image 532
Miuranga Avatar asked Nov 28 '13 11:11

Miuranga


People also ask

How would you import a large MySQL database .SQL file to phpMyAdmin using Wamp?

After opening the command line interface, you will be prompted to enter a password, just press enter in case you don't have a password. The next command is “source” followed by the path to the database you want to import and then press enter to start importing. Thanks for reading this and my other medium stories.


3 Answers

I suspect you will be able to import 1 GB file through phpmyadmin But you can try by increasing the following value in php.ini and restart the wamp.

post_max_size=1280M
upload_max_filesize=1280M
max_execution_time = 300 //increase time as per your server requirement. 

You can also try below command from command prompt, your path may be different as per your MySQL installation.

C:\wamp\bin\mysql\mysql5.5.24\bin\mysql.exe -u root -p db_name < C:\some_path\your_sql_file.sql

You should increase the max_allowed_packet of mysql in my.ini to avoid MySQL server gone away error, something like this

max_allowed_packet = 100M
like image 187
Ram Sharma Avatar answered Oct 07 '22 16:10

Ram Sharma


Step 1: Find the config.inc.php file located in the phpmyadmin directory. In my case it is located here:

C:\wamp\apps\phpmyadmin3.4.5\config.inc.php 

Note: phymyadmin3.4.5 folder name is different in different version of wamp

Step 2: Find the line with $cfg['UploadDir'] on it and update it to:

$cfg['UploadDir'] = 'upload';

Step 3: Create a directory called ‘upload’ within the phpmyadmin directory.

C:\wamp\apps\phpmyadmin3.2.0.1\upload\

Step 4: Copy and paste the large sql file into upload directory which you want importing to phymyadmin

Step 5: Select sql file from drop down list from phymyadmin to import.

like image 41
Ajay Bhayani Avatar answered Oct 07 '22 16:10

Ajay Bhayani


The values indicated by Ram Sharma might need to be changed in Wamp alias configuration files instead.

In <wamp_dir>/alias/phpmyadmin.conf, in the <Directory> section:

  php_admin_value upload_max_filesize 1280M
  php_admin_value post_max_size 1280M
  php_admin_value max_execution_time 1800
like image 42
Bob Avatar answered Oct 07 '22 17:10

Bob