解析mysql自动停止服务解决办法

卢松松博客 关注创业者、自媒体人和站长的网站

我想很多朋友都有碰到过mysql服务器突然自动停止或又会自动启动吧,下面我们来分析一下原因与停止的解决办法.

分析原因一:Mysql的自动备份功能可能导致数据库在备份的时候先关闭服务,而在此启动的时候服务器不响应,开始-运行-services.msc,打开windows服务找到mysql的服务并双击,点击恢复选项卡,第一次失败:默认是“不操作”,改成”重新启动服务”。

在下方的“重新启动服务:分钟后”添上“0”表示如果服务意外终止则立即重启动。点击确定使设置生效。这时候你在任务管理器里结束mysql-nt进程,会发现结束不掉,不过要注意,这样mysql.exe是停不了的,如果要停必须把刚才修改的改回来.)

分析原因二:可能是mysql连接问题

修改mysql的最大连接数, 使用内存变量修改法修改mysql的最大连接数

步骤如下,同时适用windows和linux平台:

a、客户端登录mysql,输入用户名和密码’

b、在mysql命令提示符下设置新的最大连接数为500:mysql> set global max_connections=500

c、显示当前运行的query:mysql> show processlist

d、显示当前mysql 系统参数状态:mysql> show status# k;

e、退出客户端:mysql> exit’

查看当前最大连接数只需要通过在mysqladmin所在目录下执行以下命令:mysqladmin -username -password variables |find “max_con” 即可看到。也可以使用php教程myadmin里头的mysql参数列表查看最大连接数。

缺点:重启计算机或者mysql后最大连接数又会复位成初始值,需要重新设定。

修改my.ini或my.cnf文件法(需要重启mysql),可参考同目录下mysql的配置模板(小内存、大内存、超大内存) . e windows系统下打开my.ini文件找到set-variable =max_connections=100这一行,改成需要设定的最大连接数,然后重启即可。

linux控制台下:

1、打开my.cnf文件:vi /etc/my.cnf

2 在[mysqld]段下修改max_connections的值为设定值。

注意:可能大家安装的mysql来源和版本不同,windows下mysql+iis和php+apache+mysql套件最终安装结果几乎都不相同,my.ini文件的路径可能有些不同,my.ini可能还会保留一份在c:windows目录下需要同时修改,这个方法是我在无意中发现的,经测试是可行的,下面拿出来和大家分享.

我的电脑 -> 右击 -> 服务 -> 找到 mysql服务 双击 新窗口中 -> 恢复 -> 第一次失败 设置为 重新启动服务.

下面重置失败计数 设置为0 重新启动服务 设置为0,就这样,就轻松搞定了mysql 自动停止的问题.

另外一种情况:

  1. 10090422:37:27InnoDB:Logfile.ib_logfile0didnotexist:newtobecreated
  2. InnoDB:Settinglogfile.ib_logfile0sizeto10MB
  3. InnoDB:Databasephysicallywritesthefilefull:wait...
  4. 10090422:37:28InnoDB:Logfile.ib_logfile1didnotexist:newtobecreated
  5. InnoDB:Settinglogfile.ib_logfile1sizeto10MB
  6. InnoDB:Databasephysicallywritesthefilefull:wait...
  7. InnoDB:Doublewritebuffernotfound:creatingnew
  8. InnoDB:Doublewritebuffercreated
  9. InnoDB:Creatingforeignkeyconstraintsystemtables
  10. InnoDB:Foreignkeyconstraintsystemtablescreated
  11. 10090422:37:29InnoDB:Started;logsequencenumber00
  12. 10090422:37:29[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  13. 10090422:37:29[ERROR]Aborting
  14. 10090422:37:29InnoDB:Startingshutdown...
  15. 10090422:37:31InnoDB:Shutdowncompleted;logsequencenumber043655
  16. 10090422:37:31[Note]wampmysqld:Shutdowncomplete
  17. 10090422:43:42InnoDB:Started;logsequencenumber043655
  18. 10090422:43:42[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  19. 10090422:43:42[ERROR]Aborting
  20. 10090422:43:42InnoDB:Startingshutdown...
  21. 10090422:43:45InnoDB:Shutdowncompleted;logsequencenumber043655
  22. 10090422:43:45[Note]wampmysqld:Shutdowncomplete
  23. 10090422:43:49InnoDB:Started;logsequencenumber043655
  24. 10090422:43:49[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  25. 10090422:43:49[ERROR]Aborting
  26. 10090422:43:49InnoDB:Startingshutdown...
  27. 10090422:43:52InnoDB:Shutdowncompleted;logsequencenumber043655
  28. 10090422:43:52[Note]wampmysqld:Shutdowncomplete
  29. 1009058:23:24InnoDB:Started;logsequencenumber043655
  30. 1009058:23:24[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  31. 1009058:23:24[ERROR]Aborting
  32. 1009058:23:24InnoDB:Startingshutdown...
  33. 1009058:23:27InnoDB:Shutdowncompleted;logsequencenumber043655
  34. 1009058:23:27[Note]wampmysqld:Shutdowncomplete
  35. 1009058:23:28InnoDB:Started;logsequencenumber043655
  36. 1009058:23:28[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  37. 1009058:23:28[ERROR]Aborting
  38. 1009058:23:28InnoDB:Startingshutdown...
  39. 1009058:23:30InnoDB:Shutdowncompleted;logsequencenumber043655
  40. 1009058:23:30[Note]wampmysqld:Shutdowncomplete
  41. 1009058:41:35InnoDB:Started;logsequencenumber043655
  42. 1009058:41:35[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  43. 1009058:41:35[ERROR]Aborting
  44. 1009058:41:35InnoDB:Startingshutdown...
  45. 1009058:41:37InnoDB:Shutdowncompleted;logsequencenumber043655
  46. 1009058:41:37[Note]wampmysqld:Shutdowncomplete
  47. 1009058:41:42InnoDB:Started;logsequencenumber043655
  48. 1009058:41:42[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  49. 1009058:41:42[ERROR]Aborting
  50. 1009058:41:42InnoDB:Startingshutdown...
  51. 1009058:41:45InnoDB:Shutdowncompleted;logsequencenumber043655
  52. 1009058:41:45[Note]wampmysqld:Shutdowncomplete
  53. 1009058:47:15InnoDB:Started;logsequencenumber043655
  54. 1009058:47:15[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  55. 1009058:47:15[ERROR]Aborting
  56. 1009058:47:15InnoDB:Startingshutdown...
  57. 1009058:47:17InnoDB:Shutdowncompleted;logsequencenumber043655
  58. 1009058:47:17[Note]wampmysqld:Shutdowncomplete
  59. 1009058:54:20InnoDB:Started;logsequencenumber043655
  60. 1009058:54:20[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  61. 1009058:54:20[ERROR]Aborting
  62. 1009058:54:20InnoDB:Startingshutdown...
  63. 1009058:54:23InnoDB:Shutdowncompleted;logsequencenumber043655
  64. 1009058:54:23[Note]wampmysqld:Shutdowncomplete
  65. 1009058:54:53InnoDB:Started;logsequencenumber043655
  66. 1009058:54:53[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  67. 1009058:54:53[ERROR]Aborting
  68. 1009058:54:53InnoDB:Startingshutdown...
  69. 1009058:54:55InnoDB:Shutdowncompleted;logsequencenumber043655
  70. 1009058:54:55[Note]wampmysqld:Shutdowncomplete
  71. 1009058:58:20InnoDB:Started;logsequencenumber043655
  72. 1009058:58:20[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  73. 1009058:58:20[ERROR]Aborting
  74. 1009058:58:20InnoDB:Startingshutdown...
  75. 1009058:58:22InnoDB:Shutdowncompleted;logsequencenumber043655
  76. 1009058:58:22[Note]wampmysqld:Shutdowncomplete
  77. 1009058:59:57InnoDB:Started;logsequencenumber043655
  78. 1009058:59:57[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  79. 1009058:59:57[ERROR]Aborting
  80. 1009058:59:57InnoDB:Startingshutdown...
  81. 1009059:00:00InnoDB:Shutdowncompleted;logsequencenumber043655
  82. 1009059:00:00[Note]wampmysqld:Shutdowncomplete
  83. 1009059:02:21InnoDB:Started;logsequencenumber043655
  84. 1009059:02:21[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  85. 1009059:02:21[ERROR]Aborting
  86. 1009059:02:21InnoDB:Startingshutdown...
  87. 1009059:02:23InnoDB:Shutdowncompleted;logsequencenumber043655
  88. 1009059:02:23[Note]wampmysqld:Shutdowncomplete
  89. 1009059:02:29InnoDB:Started;logsequencenumber043655
  90. 1009059:02:29[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  91. 1009059:02:29[ERROR]Aborting
  92. 1009059:02:29InnoDB:Startingshutdown...
  93. 1009059:02:31InnoDB:Shutdowncompleted;logsequencenumber043655
  94. 1009059:02:31[Note]wampmysqld:Shutdowncomplete
  95. 1009059:08:16InnoDB:Started;logsequencenumber043655
  96. 1009059:08:16[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  97. 1009059:08:16[ERROR]Aborting
  98. 1009059:08:16InnoDB:Startingshutdown...
  99. 1009059:08:18InnoDB:Shutdowncompleted;logsequencenumber043655
  100. 1009059:08:18[Note]wampmysqld:Shutdowncomplete
  101. 1009059:08:54InnoDB:Started;logsequencenumber043655
  102. 1009059:08:54[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  103. 1009059:08:54[ERROR]Aborting
  104. 1009059:08:54InnoDB:Startingshutdown...
  105. 1009059:08:56InnoDB:Shutdowncompleted;logsequencenumber043655
  106. 1009059:08:56[Note]wampmysqld:Shutdowncomplete
  107. 1009059:35:05InnoDB:Started;logsequencenumber043655
  108. 1009059:35:05[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  109. 1009059:35:05[ERROR]Aborting
  110. 1009059:35:05InnoDB:Startingshutdown...
  111. 1009059:35:08InnoDB:Shutdowncompleted;logsequencenumber043655
  112. 1009059:35:08[Note]wampmysqld:Shutdowncomplete
  113. 1009059:38:08InnoDB:Started;logsequencenumber043655
  114. 1009059:38:08[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  115. 1009059:38:08[ERROR]Aborting
  116. 1009059:38:08InnoDB:Startingshutdown...
  117. 1009059:38:10InnoDB:Shutdowncompleted;logsequencenumber043655
  118. 1009059:38:10[Note]wampmysqld:Shutdowncomplete
  119. 10090516:18:51InnoDB:Started;logsequencenumber043655
  120. 10090516:18:52[ERROR]Doyoualreadyhaveanothermysqldserverrunningonport:3306?
  121. 10090516:18:52[ERROR]Aborting
  122. --phpfensi.com
  123. 10090516:18:52InnoDB:Startingshutdown...
  124. 10090516:18:54InnoDB:Shutdowncompleted;logsequencenumber043655
  125. 10090516:18:54[Note]wampmysqld:Shutdowncomplete

经过分析是:3306端口被占用了.

1.以前安装的mysql没有卸载干净

2.其他程序(如迅雷随机获取端口号)占用了3306端口

这样就好办了,只要在mysql配置文件把端口修改一下就可以了.

相关广告
  • 解析mysql自动停止服务解决办法 解析mysql自动停止服务解决办法 解析mysql自动停止服务解决办法
相关阅读

解析mysql自动停止服务解决办法

2019/10/10 17:33:16 | 谷歌SEO算法 | SEO技术