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

前端 未结 13 2009
旧巷少年郎
旧巷少年郎 2020-12-04 09:46

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

相关标签:
13条回答
  • 2020-12-04 10:30

    I've tried with the SQLyog and It has done the work.

    0 讨论(0)
  • 2020-12-04 10:31

    If you will try to load such a large file through phpmyadmin then you would need to change upload_file_size in php.ini to your requirements and then after uploading you will have to revert it back. What will happen? If you would like to load a 3GB file. You will have to change those parameters in php.ini again.

    The best solution to solve this issue to open command prompt in windows.

    Find path of wamp mysql directory.

    Usually, it is C:/wamp64/bin/mysql/mysqlversion/bin/mysql.exe

    Execute mysql -u root

    You will be in mysql command prompt

    Switch database with use command.

    mysql> use database_name
    mysql> source [file_path]
    

    In case of Windows, here is the example.

    mysql> source C:/sqls/sql1GB.sql
    

    That's it. If you will have a database over 10GB or 1000GB. This method will still work for you.

    0 讨论(0)
  • 2020-12-04 10:33

    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
    
    0 讨论(0)
  • 2020-12-04 10:33

    You can do it in following ways;

    1. 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

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

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

    4. 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 讨论(0)
  • 2020-12-04 10:37

    I also face the same problem and strangely changing the values in php.ini did not worked for me. So I found out one more solution which worked for me.

    • Click your Wamp server icon -> MySql -> MySql console
    • Once mysql console is open. Enter your mysql password. and give these commands.

      1. use user_database_name
      2. source c:/your/sql/path/filename.sql

    If you still have problems watch this video.

    0 讨论(0)
  • 2020-12-04 10:38

    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
    
    0 讨论(0)
提交回复
热议问题