如何将 1GB .sql 文件导入 WAMP/phpmyadmin

2022-01-05 00:00:00 sql wamp mysql phpmyadmin

我想将超过 1GB 大小的 sql 文件导入 localhost WAMP/phpmyadmin 中的 MySQL 数据库.但是phpmyadmin UI 不允许导入这么大的文件.

有哪些可能的方法可以做到这一点,例如任何 SQL 查询以导入 .sql 文件?

谢谢

解决方案

我怀疑你可以通过 phpmyadmin 导入 1 GB 的文件但是你可以尝试在 php.ini 中增加以下值并重新启动 wamp.

>

post_max_size=1280Mupload_max_filesize=1280Mmax_execution_time = 300//根据您的服务器要求增加时间.

您也可以从命令提示符尝试以下命令,您的路径可能因您的 MySQL 安装而异.

C:wampinmysqlmysql5.5.24inmysql.exe -u root -p db_name <C:some_pathyour_sql_file.sql

你应该在my.ini中增加mysql的max_allowed_pa​​cket以避免MySQL server go away错误,类似这样

max_allowed_pa​​cket = 100M

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

解决方案

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:wampinmysqlmysql5.5.24inmysql.exe -u root -p db_name < C:some_pathyour_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

相关文章