一、报错提示:

二、报错原因:

原因一:

一种可能是发送的 SQL 语句太长,以致超过了 max_allowed_packet 的大小,如果是这种原因,你只要修改 my.cnf,加大 max_allowed_packet 的值即可。

原因二:
一开始某些SQL执行成功,但是后面的SQL执行失败报错gone away,大部分原因就是这个连接被闲置超过了wait_timeout,mysql服务器单方面断掉了这个连接。

三、解决办法:

修改 my.cnf 配置,添加以下配置

mysql]# cat conf/docker.cnf
....
#增加超时时间
wait_timeout=28800
interactive_timeout=28800
max_allowed_packet = 10M #增加传输大小

四、重启服务

 docker restart 容器名称/id

mysql报错:MySQL server has gone away的更多相关文章

  1. 连接mysql报错 : The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone...

    time zone 时区错误 DBEAVER连接MySQL运行报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or repres ...

  2. 解决MySQL报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents .....

    1.前言 今天在用SpringBoot2.0+MyBatis+MySQL搭建项目开发环境的时候启动项目发现报了一个很奇怪的错,报错内容如下: java.sql.SQLException: The se ...

  3. Spring Boot连接MySQL报错“Internal Server Error”的解决办法

    报错信息如下: {timestamp: "2018-06-14T03:48:23.436+0000", status: 500, error: "Internal Ser ...

  4. SpringBoot------连接MySQL报错:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized

    报错提示: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zon ...

  5. MySQL 报错MySQL server syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT'

    在hive的应用中,出现如下错误时You have an error in your SQL syntax; check the manual that corresponds to your MyS ...

  6. lnmp下启动mysql报错 The server quit without updating PID file

    启动时候错误代码:Starting MySQL[FAIL.] The server quit without updating PID file (/var/run/mysqld/mysqld.pid ...

  7. 连接MySQL报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.

    MySQL time zone 时区错误 使用root用户登陆执行命令: ---> show variables like '%time_zone%'; 默认值system为美国时间:如下图: ...

  8. MySQL报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents

    参考资料:https://blog.csdn.net/qq_37630354/article/details/82814330 在property里加上最后这个参数即可

  9. PHP连接MySQL报错:SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' (2)

    如下所示,PHP连接MySQL报错: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' ...

  10. Asp.Net连接Mysql报错Out of sync with server

    Asp.Net连接Mysql报错Out of sync with server 原因:程序引用的MySql.Data.dll版本高于服务器版本 解决:下载一个低版本的MySql.Data.dll,项目 ...

随机推荐

  1. php pdo如何查询记录条数

    转载php中文网:https://www.php.cn/php-ask-457710.html php pdo查询记录条数的方法:1.使用fetchAll函数查询,其语法如"$rows=$q ...

  2. .Net 6 miniAPI

    启动:1.双击 WebApplication1.exe文件   2.dotnet WebApplication1.dll --urls "http://localhost:5403;http ...

  3. node.js 历史版本下载

    https://nodejs.org/zh-cn/download/releases/

  4. XMLHttpRequest、Ajax、Fetch与Axios

    1. 引言 XMLHttpRequest.Ajax.Fetch与Axios是网页前后端交互中常见到的名词 参考MDN:Ajax - Web 开发者指南 | MDN (mozilla.org) Ajax ...

  5. RocketMQ - 消费者消费方式

    RocketMQ的消费方式包含Pull和Push两种 Pull方式:用户主动Pull消息,自主管理位点,可以灵活地掌控消费进度和消费速度,适合流计算.消费特别耗时等特殊的消费场景.缺点也显而易见,需要 ...

  6. Spark Streaming实时计算

    spark批处理模式: receiver模式:接收数据流,负责数据的存储维护,缺点:数据维护复杂(可靠性,数据积压等),占用计算资源(core,memory被挤占) direct模式:数据源由三方组件 ...

  7. RestTemplate 请求

    @Autowired private RestTemplate httpRestTemplate; String code= request.getParameter("code" ...

  8. File类-绝对路径 相对路径

    绝对路径:通过给定的路径能够直接在我的电脑中找到的文件 相对路径:文件相对于应用程序的路径 结论: 我们在开发中要尽量使用相对路径 File方法只能读取小文件,是一下子全读出来.如果读大文件则使用文件 ...

  9. Mysql去重获取最新的一条数据

    Mysql去重获取最新的一条数据 select * from yjzt_kindergartens r where id in (select max(id) from yjzt_kindergart ...

  10. Charles 抓包教程(Mac版)

    Charles 抓包使用教程 (Mac版) Charles简介 Charles是一个HTTP代理服务器,HTTP监视器,反转代理服务器,当浏览器连接Charles的代理访问互联网时,Charles可以 ...