修复将数据库导入 Wampserver 时出现的 1064 SQL 错误

Fixing 1064 SQL Error Importing Database into Wampserver

将我的 636MB 数据库导入 Wampserver 时出现以下错误。有趣的是,我在 (php.ini) 中将最大执行时间设置为 5000。我还尝试了很多导入方法和压缩类型,结果都相同:MySql Console、PhpMyAdmin Console、BigDump、zip、gzip,最后使用 config.inc.php 上传指定目录。感谢您提供的所有帮助、建议和建议。

当前设置:

php.ini:
post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M

config.inc.php:
// 以秒为单位的最大执行时间(0 表示无限制)
$cfg['ExecTimeLimit'] = 0;

my.ini:
max_allowed_packet = 200M

MySQL said: 
1064 - Erreur de syntaxe près de '<br />
Fatal error:  Maximum execution time of 300 seconds exceeded in <b' Ã  la ligne 141

Error
SQL query: 

INSERT INTO `log_url_info` (`url_id`, `url`, `referer`) VALUES
(2287337, 'http://www.website12345.com/sendfriend/product/send/id/44894/', NULL),
(2287338, 'http://www.website12345.com/sendfriend/product/send/id/44894/', NULL),
(2287339, 'http://www.website12345.com/sendfriend/product/send/id/44894/', NULL),
(2287340, 'http://www.website12345.com/catalog/category/view/id/66', NULL),
(2287341, 'http://www.website12345.com/catalog/category/view/id/718?multi_select_color_filter=2040', NULL),
(2287342, 'http://www.website12345.com/catalog/category/view/id/879?price=1000-2000', NULL),
(2287343, 'http://www.website12345.com/catalog/category/view/id/152?

limit=15&manufacturer=351&mode=list&multi_select_finish_filter=2602&multi_select_material_filter=2060&price=-1000', NULL),
(2287344, 'http://www.website12345.com/sendfriend/product/send/id/30583/', NULL),
(2287345, 'http://www.website12345.com/catalog/category/view/id/673?multi_select_finish_filter=2025', NULL),
(2287346, 'ht[...]

您的 SQL 查询似乎有一些语法错误,请先尝试检查一下。

我已经成功地使用命令行导入了一个 800mb 的数据库。

尝试:

mysql -p -u username -h 127.0.0.1 database < database.sql

如果有效请告诉我。

phpMyAdmin 的 max_execution_time 现在由

中的别名定义控制
\wamp\alias\phpmyadmin.conf

WAMPServer 2.5 版本

Alias /phpmyadmin "c:/wamp/apps/phpmyadmin4.1.14/"

# to give access to phpmyadmin from outside 
# replace the lines
#
# Require local
#
# by
#
# Require all granted
#

<Directory "c:/wamp/apps/phpmyadmin4.1.14/">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride all
  <IfDefine APACHE24>
    Require local
  </IfDefine>
  <IfDefine !APACHE24>
    Order Deny,Allow
      Deny from all
      Allow from localhost ::1 127.0.0.1
    </IfDefine>
  php_admin_value upload_max_filesize 128M
  php_admin_value post_max_size 128M
  php_admin_value max_execution_time 360
  php_admin_value max_input_time 360
</Directory>

注意这4个参数的使用

  php_admin_value upload_max_filesize 128M
  php_admin_value post_max_size 128M
  php_admin_value max_execution_time 360
  php_admin_value max_input_time 360

您可能需要修改upload_max_filesizemax_execution_time

在需要的地方修改然后重新启动 Apache

left click wampmanager -> Apache -> Service _Restart Service

现在PHP当你是运行phpMyAdmin时会注意这些新参数。

已解决!我不得不在导出时截断和优化日志表和 select "Disable foreign key checks"。和数据库导入!无需其他更改。