use*_*890 5 mysql amazon-web-services
我收到MySQL server has gone away错误。我不太清楚为什么会发生这种情况,但经过一些研究后,最常推荐的答案是编辑 cnf 文件以增加数据包大小和其他设置。
问题是我找不到这个文件。会在哪里呢?
我在下面找到一个my.cnf文件/etc,但它包含以下内容:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Run Code Online (Sandbox Code Playgroud)
谢谢
您可以通过在 config.php 中设置变量来更改允许的最大数据包大小。
只需添加max_allowed_packet=500M到该[mysqld]部分即可。
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
max_allowed_packet=500M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Run Code Online (Sandbox Code Playgroud)
更新配置后需要重启MySQL服务才能生效。
注意:变量的最大大小为 1024 MB。
| 归档时间: |
|
| 查看次数: |
3169 次 |
| 最近记录: |