gpt4 book ai didi

mysql - PDO异常 : General error: 2006 MySQL server has gone away

转载 作者:行者123 更新时间:2023-11-29 04:39:22 25 4
gpt4 key购买 nike

Drupal 7

每当我访问“配置”>“搜索和元数据”>“URL 别名”>“模式”(localhost/admin/config/search/path/patterns) 时出现此错误

原创

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT 1 AS expression FROM {variable} variable WHERE ( (name = :db_condition_placeholder_0) ); Array ( [:db_condition_placeholder_0] => drupal_css_cache_files ) in variable_set() (line 991 of /home/www/icts-website/includes/bootstrap.inc).

额外的

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => php [:db_insert_placeholder_2] => %type: !message in %function (line %line of %file). [:db_insert_placeholder_3] => a:6:{s:5:"%type";s:12:"PDOException";s:8:"!message";s:235:"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT 1 AS expression FROM {variable} variable WHERE ( (name = :db_condition_placeholder_0) ); Array ( [:db_condition_placeholder_0] => drupal_css_cache_files ) ";s:9:"%function";s:14:"variable_set()";s:5:"%file";s:45:"/home/www/icts-website/includes/bootstrap.inc";s:5:"%line";i:991;s:14:"severity_level";i:3;} [:db_insert_placeholder_4] => 3 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://localhost/admin/config/search/path/patterns [:db_insert_placeholder_7] => http://localhost/ [:db_insert_placeholder_8] => 10.0.8.14 [:db_insert_placeholder_9] => 1444714070 ) in dblog_watchdog() (line 160 of /home/www/icts-website/modules/dblog/dblog.module).

关闭函数中抛出未捕获的异常。

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: DELETE FROM {semaphore} WHERE (value = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 399784779561c9655b48719.42544548 ) in lock_release_all() (line 269 of /home/www/icts-website/includes/lock.inc).

我用谷歌搜索了解决方案,并将 max_allowed_pa​​cket 增加到 32M,但错误页面仍然存在。

非常感谢您帮助解决这个问题。

my.cnf 文件详细信息如下:

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

# include all files from the config directory
!includedir /etc/my.cnf.d

max_allowed_packet = 32M

我正在使用 CentOS 7 和 MySQL。

最佳答案

是的,此错误与解析大量数据有关,因此数据库因给定限制而无法处理此类大小而失败,因此服务器超时并关闭连接。

要修复它,您需要进一步增加 my.cnfmax_allowed_pa​​cket 的值(例如 ~/.my.cnf) [mysqld] 部分下,例如

[mysqld]
max_allowed_packet=256M

尝试使用 256M,如果没有帮助,请尝试进一步增加(例如 1G)。

在你的情况下,我认为 max_allowed_pa​​cket 应该具体在 [mysqld] 部分下,而不是在 [mysqld_safe] 下,因此应用设置到正确的组件。

参见:B.5.2.9 MySQL server has gone away获取更多详细信息。

另一件事是,在这种特殊情况下,它发生在关闭函数中(在 Drupal 完成站点处理之后),因此它可能与某些 cron 或调试任务有关。

关于mysql - PDO异常 : General error: 2006 MySQL server has gone away,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33097854/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com