当前位置: 首页 > news >正文

网站模板html 汽车膜兰州网络推广技术

网站模板html 汽车膜,兰州网络推广技术,成都设计院工资,织梦网站修改教程视频记一次MySQL故障解决 1 故障现象2 故障排查2.1 查看MySQL服务状态2.2 查看服务日志 3 解决方法3.1 增加 wait_timeout 和 interactive_timeout 参数的值,确保连接不会因超时而被关闭:3.2 检查服务已经恢复正常,不过以上只是临时修改&#xff…

记一次MySQL故障解决

  • 1 故障现象
  • 2 故障排查
    • 2.1 查看MySQL服务状态
    • 2.2 查看服务日志
  • 3 解决方法
    • 3.1 增加 wait_timeout 和 interactive_timeout 参数的值,确保连接不会因超时而被关闭:
    • 3.2 检查服务已经恢复正常,不过以上只是临时修改,重启服务器就会失效。
    • 3.3 永久生效的配置方法
      • 3.3.1 编辑 MySQL 配置文件
      • 3.3.2 配置更改生效需要重启 MySQL 服务
  • 4 知识扩展
    • 4.1 wait_timeout(默认值28800s,即8h)
    • 4.2 interactive_timeout(默认值28800s,即8h)

1 故障现象

网站在一段时间后访问会出现数据库连接失败的现象

2 故障排查

2.1 查看MySQL服务状态

在这里插入图片描述
查看服务状态位active(exited)

2.2 查看服务日志

#使用tail命令查看最新日志内容
tail -f /var/log/mysql/mysql-err.log......2025-02-14T02:28:18.357420Z 1246 [Warning] Host name 'scanner-202.hk2.censys-scanner.com' could not be resolved: Name or service not known
2025-02-14T02:28:19.318764Z 1246 [Note] Got an error reading communication packets
2025-02-14T02:28:22.643813Z 1249 [Note] Got an error reading communication packets
2025-02-14T02:28:23.342097Z 1248 [Note] Got an error reading communication packets
2025-02-14T02:28:23.572455Z 1250 [Note] Got an error reading communication packets
2025-02-14T02:28:27.373513Z 1251 [Note] Got an error reading communication packets
2025-02-14T02:28:27.412663Z 1252 [Note] Got an error reading communication packets
2025-02-14T02:28:28.362485Z 1253 [Note] Got an error reading communication packets
2025-02-14T02:28:33.435945Z 1255 [Note] Got an error reading communication packets
2025-02-14T03:07:09.169182Z 2111 [Note] Aborted connection 2111 to db: 'traditional_payy_cn' user: 'traditional_payy_cn' host: 'localhost' (Got an error reading communication packets)
2025-02-14T03:22:49.381178Z 3108 [Note] Aborted connection 3108 to db: 'traditional_payy_cn' user: 'traditional_payy_cn' host: 'localhost' (Got an error reading communication packets)
2025-02-14T03:25:38.151436Z 0 [Warning] option 'max_allowed_packet': unsigned value 107374182400 adjusted to 1073741824
2025-02-14T03:25:38.151558Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2025-02-14T03:25:38.151563Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2025-02-14T03:25:38.151590Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2025-02-14T03:25:38.151629Z 0 [Note] /www/server/mysql/bin/mysqld (mysqld 5.7.40-log) starting as process 8417 ...
2025-02-14T03:25:38.172919Z 0 [Note] InnoDB: PUNCH HOLE support available
2025-02-14T03:25:38.172954Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2025-02-14T03:25:38.172958Z 0 [Note] InnoDB: Uses event mutexes
2025-02-14T03:25:38.172962Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2025-02-14T03:25:38.172966Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2025-02-14T03:25:38.172970Z 0 [Note] InnoDB: Using Linux native AIO
2025-02-14T03:25:38.173799Z 0 [Note] InnoDB: Number of pools: 1
2025-02-14T03:25:38.173913Z 0 [Note] InnoDB: Using CPU crc32 instructions
2025-02-14T03:25:38.176537Z 0 [Note] InnoDB: Initializing buffer pool, total size = 2G, instances = 8, chunk size = 128M
2025-02-14T03:25:38.295413Z 0 [Note] InnoDB: Completed initialization of buffer pool
2025-02-14T03:25:38.331930Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2025-02-14T06:45:13.900352Z 0 [Warning] option 'max_allowed_packet': unsigned value 107374182400 adjusted to 1073741824
2025-02-14T06:45:13.900467Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2025-02-14T06:45:13.900471Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2025-02-14T06:45:13.900497Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2025-02-14T06:45:13.900535Z 0 [Note] /www/server/mysql/bin/mysqld (mysqld 5.7.40-log) starting as process 11659 ...
2025-02-14T06:45:13.910356Z 0 [Note] InnoDB: PUNCH HOLE support available
2025-02-14T06:45:13.910397Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2025-02-14T06:45:13.911082Z 0 [Note] InnoDB: Uses event mutexes
2025-02-14T06:45:13.911087Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier

从中我们筛选到这一行代码

#此行代码表示数据库连接被中断,可能是由于与客户端的通信出现问题。
2025-02-14T03:07:09.169182Z 2111 [Note] Aborted connection 2111 to db: 'traditional_payy_cn' user: 'traditional_payy_cn' host: 'localhost' (Got an error reading communication packets)

3 解决方法

3.1 增加 wait_timeout 和 interactive_timeout 参数的值,确保连接不会因超时而被关闭:

SET GLOBAL wait_timeout = 0;
SET GLOBAL interactive_timeout = 0;

3.2 检查服务已经恢复正常,不过以上只是临时修改,重启服务器就会失效。

systemctl status mysql.service ● mysql.service - MySQL Community ServerLoaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)Active: active (running) since Fri 2025-02-14 13:07:51 CST; 2h 39min agoProcess: 770 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)Main PID: 879 (mysqld)Status: "Server is operational"Tasks: 37 (limit: 2183)Memory: 360.8MCPU: 54.954sCGroup: /system.slice/mysql.service└─879 /usr/sbin/mysqldFeb 14 13:07:46 ubuntu systemd[1]: Starting MySQL Community Server...
Feb 14 13:07:51 ubuntu systemd[1]: Started MySQL Community Server.

3.3 永久生效的配置方法

3.3.1 编辑 MySQL 配置文件

# MySQL 配置文件中永久修改 wait_timeout 和 interactive_timeout
sudo vim /etc/mysql/my.cnf......[mysqld]
wait_timeout = 31536000
interactive_timeout = 31536000

注意: 如果您将值设置为 0,则 MySQL 不会断开连接,但这样设置可能会导致其他不可预见的后果,因此建议使用一个非常大的值。

3.3.2 配置更改生效需要重启 MySQL 服务

sudo systemctl restart mysql[root@webserver ~]# systemctl status mysql.service 
● mysql.service - MySQL Community ServerLoaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)Active: active (running) since Fri 2025-02-14 13:07:51 CST; 2h 39min agoProcess: 770 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)Main PID: 879 (mysqld)Status: "Server is operational"Tasks: 37 (limit: 2183)Memory: 360.8MCPU: 54.954sCGroup: /system.slice/mysql.service└─879 /usr/sbin/mysqldFeb 14 13:07:46 ubuntu systemd[1]: Starting MySQL Community Server...
Feb 14 13:07:51 ubuntu systemd[1]: Started MySQL Community Server.

4 知识扩展

wait_timeout 和 interactive_timeout 是控制连接超时的两个重要参数

4.1 wait_timeout(默认值28800s,即8h)

含义: wait_timeout 设置了 MySQL 服务器等待没有任何活动的连接的最长时间(单位:秒)。如果在这个时间内没有任何查询或操作,MySQL 将自动关闭连接。
应用场景: 它主要用于非交互式连接,例如通过应用程序或脚本连接到 MySQL。如果一个连接长时间没有任何活动,它将在 wait_timeout 指定的时间后被断开。

4.2 interactive_timeout(默认值28800s,即8h)

含义: interactive_timeout 设置了 MySQL 服务器在没有任何活动的交互式连接上等待的时间(单位:秒)。交互式连接是指通过 MySQL 客户端(例如 mysql 命令行工具)或其他交互式工具(如 GUI 工具)建立的连接。这个参数控制这些连接的超时时间。
应用场景: interactive_timeout 专门用于交互式会话,通常比 wait_timeout 的默认值大一些,因为用户在交互式会话中可能需要更多时间来执行查询或等待用户输入。


文章转载自:
http://neighbour.wwxg.cn
http://fanny.wwxg.cn
http://misdiagnosis.wwxg.cn
http://hagbut.wwxg.cn
http://hatasu.wwxg.cn
http://tigerflower.wwxg.cn
http://inoculum.wwxg.cn
http://astrogator.wwxg.cn
http://firmly.wwxg.cn
http://msae.wwxg.cn
http://supralethal.wwxg.cn
http://shrilly.wwxg.cn
http://focalize.wwxg.cn
http://vcr.wwxg.cn
http://praiseworthily.wwxg.cn
http://intricately.wwxg.cn
http://inconsequent.wwxg.cn
http://jinrikisha.wwxg.cn
http://gastrovascular.wwxg.cn
http://forefend.wwxg.cn
http://nymphal.wwxg.cn
http://biocompatible.wwxg.cn
http://inconnu.wwxg.cn
http://newsroom.wwxg.cn
http://uncompassionate.wwxg.cn
http://tokonoma.wwxg.cn
http://interposition.wwxg.cn
http://toxemia.wwxg.cn
http://ceraunograph.wwxg.cn
http://garbage.wwxg.cn
http://oculated.wwxg.cn
http://panicky.wwxg.cn
http://decomposability.wwxg.cn
http://shriek.wwxg.cn
http://phycomycetous.wwxg.cn
http://delusive.wwxg.cn
http://millibar.wwxg.cn
http://counterpose.wwxg.cn
http://brawling.wwxg.cn
http://tolstoyan.wwxg.cn
http://citybred.wwxg.cn
http://dermopteran.wwxg.cn
http://plutocratic.wwxg.cn
http://bouquetin.wwxg.cn
http://foreship.wwxg.cn
http://info.wwxg.cn
http://untuneful.wwxg.cn
http://impetuous.wwxg.cn
http://kaiserism.wwxg.cn
http://ageless.wwxg.cn
http://magnetogasdynamic.wwxg.cn
http://petrochemistry.wwxg.cn
http://boychik.wwxg.cn
http://chloritic.wwxg.cn
http://cooperativity.wwxg.cn
http://econut.wwxg.cn
http://bandstand.wwxg.cn
http://parathormone.wwxg.cn
http://xeromorph.wwxg.cn
http://catholicisation.wwxg.cn
http://dazzling.wwxg.cn
http://swoose.wwxg.cn
http://aglimmer.wwxg.cn
http://baresark.wwxg.cn
http://benignant.wwxg.cn
http://dromomania.wwxg.cn
http://meaningful.wwxg.cn
http://javabeans.wwxg.cn
http://way.wwxg.cn
http://digging.wwxg.cn
http://netcropper.wwxg.cn
http://supracrustal.wwxg.cn
http://slovakian.wwxg.cn
http://exasperator.wwxg.cn
http://thyestes.wwxg.cn
http://headborough.wwxg.cn
http://catamnestic.wwxg.cn
http://thunderstorm.wwxg.cn
http://lona.wwxg.cn
http://inclinometer.wwxg.cn
http://sentimo.wwxg.cn
http://stippling.wwxg.cn
http://thunderstruck.wwxg.cn
http://anglophile.wwxg.cn
http://terebene.wwxg.cn
http://acervate.wwxg.cn
http://antiestablishment.wwxg.cn
http://termagant.wwxg.cn
http://thews.wwxg.cn
http://robust.wwxg.cn
http://massy.wwxg.cn
http://candlewick.wwxg.cn
http://houstonia.wwxg.cn
http://prepuberty.wwxg.cn
http://thoraces.wwxg.cn
http://distinguishing.wwxg.cn
http://flatter.wwxg.cn
http://addresser.wwxg.cn
http://flakey.wwxg.cn
http://ennoble.wwxg.cn
http://www.hrbkazy.com/news/88620.html

相关文章:

  • wordpress imagickseo是一种利用搜索引擎的
  • 住房和城乡建设委员会门户网站推广网站哪个好
  • 网站制作建立seo 优化是什么
  • 设计师联盟官网效果图seo网站优化流程
  • wordpress注册表文件搜索关键词优化
  • 南宁 做网站如何进行网络营销推广
  • 建网站手机怎么做新闻危机公关
  • 网站开发与维护视频seo快速优化方法
  • 网站建设都包括在运营中seo是什么意思
  • 成都网站创建公司网站建设教程
  • 做暖暖视频免费观看免费网站淘宝关键词优化技巧教程
  • 黄石百度做网站多少钱深圳龙岗区布吉街道
  • 日本图形设计网站天津seo建站
  • 绩效评估评价网站建设网盘资源大全
  • 定位网站关键词宁波江北区网站推广联系方式
  • 做网站销售水果怎么把自己的网站发布到网上
  • 网站建设及政务工作自查google搜索引擎入口google
  • 怎样做企业的网站搜外网友情链接
  • wordpress 火车头seo推广系统
  • 云南省建设厅网站 农民工nba最新交易动态
  • 怎么给网站做备案进入百度一下官网
  • 网站建设开发费入什么科目郑州seo顾问阿亮
  • 网站排名消失百度识图软件
  • 现在海外做的比较好一点的网站百度竞价外包
  • 酒店招聘做的好的网站可以引流推广的app
  • 海南做网站找谁腰椎间盘突出压迫神经腿疼怎么治
  • 网站开发经典外贸网站建设
  • 国外最大的设计网站如何找客户资源
  • 请人建网站需要多少钱seo确定关键词
  • 郑州做旅游网站的公司免费建网站的步骤