gpt4 book ai didi

导入大型 sql 文件时 MySQL 服务器消失了

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

我尝试通过phpMyAdmin导入一个大的sql文件...但它一直显示错误

'MySql server has gone away'

要做什么?

最佳答案

如上所述here :

Two most common reasons (and fixes) for the MySQL server has gone away (error 2006) are:

Server timed out and closed the connection. How to fix:

  1. check that wait_timeout variable in your mysqld’s my.cnf configuration file is large enough. On Debian: sudo nano
    /etc/mysql/my.cnf
    , set wait_timeout = 600 seconds (you can tweak/decrease this value when error 2006 is gone), then sudo
    /etc/init.d/mysql restart
    . I didn't check, but the default value for wait_timeout might be around 28800 seconds (8 hours).

  2. Server dropped an incorrect or too large packet. If mysqld gets a packet that is too large or incorrect, it assumes that something has gone wrong with the client and closes the connection. You can increase the maximal packet size limit by increasing the value of max_allowed_packet in my.cnf file. On Debian: sudo nano
    /etc/mysql/my.cnf
    , set max_allowed_packet = 64M (you can tweak/decrease this value when error 2006 is gone), then sudo
    /etc/init.d/mysql restart
    .

编辑:

请注意,MySQL 选项文件的命令尚未可用作注释(例如在 php.ini 中)。因此,您必须在 my.cnfmy.ini 中键入任何更改/调整,并将它们放入 mysql/data 目录或任何其他路径,在适当的选项组下,例如 [client][myslqd] 等。例如:

[mysqld]
wait_timeout = 600
max_allowed_packet = 64M

然后重新启动服务器。要获取它们的值,请在 mysql 客户端中输入:

> select @@wait_timeout;
> select @@max_allowed_packet;

关于导入大型 sql 文件时 MySQL 服务器消失了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40062091/

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