Tuesday, 13 November 2018

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 ?

 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
if you have much bigger db than increase the max_allowed_packet 
of mysql in my.ini to avoid MySQL server gone away error, something like this
max_allowed_packet = 100M



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



What are the possible ways to do that such as any SQL query to import .sql file ?
Try this
 mysql -u<user> -p<password> <database name> < /path/to/dump.sql
assuming dump.sql is your 1 GB dump file



Make sure to check the phpMyAdmin config file as well! On newer 
WAMP applications it is set to 128Mb by default. Even if you update php.ini 
to desired values you still need to update the phpmyadmin.conf!
Sample path: C:\wamp64\alias\phpmyadmin.conf
Or edit through your WAMP icon by: ->Apache -> Alias directories -> phpMyAdmin



You can do it in following ways;
You can go to control panel/cpanel and add host % It means now the 
database server can be accessed from your local machine. Now you can install 
and use MySQL Administrator or Navicat to import and export database with out
 using PHP-Myadmin, I used it several times to upload 200 MB to 500 MB of data 
with no issues

Use gzip, bzip2 compressions for exporting and importing. I am using PEA ZIP 
software (free) in Windows. Try to avoid Winrar and Winzip


Use MySQL Splitter that splits up the sql file into several parts. In my personal suggestion, 
Not recommended

Using PHP INI setting (dynamically change the max upload and max execution time) as 
already mentioned by other friends is fruitful but not always.




0 comments:

Post a Comment