分析原因一: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後最大連接數又會復位成初始值,需要重新設定。
2、修改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 自動停止的問題.
另外一種情況
100904 22:37:27 InnoDB: Log file .ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .ib_logfile0 size to 10 MB
InnoDB: Database physically writes the file full: wait...
100904 22:37:28 InnoDB: Log file .ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .ib_logfile1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
100904 22:37:29 InnoDB: Started; log sequence number 0 0
100904 22:37:29 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100904 22:37:29 [ERROR] Aborting
100904 22:37:29 InnoDB: Starting shutdown...
100904 22:37:31 InnoDB: Shutdown completed; log sequence number 0 43655
100904 22:37:31 [Note] wampmysqld: Shutdown complete
100904 22:43:42 InnoDB: Started; log sequence number 0 43655
100904 22:43:42 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100904 22:43:42 [ERROR] Aborting
100904 22:43:42 InnoDB: Starting shutdown...
100904 22:43:45 InnoDB: Shutdown completed; log sequence number 0 43655
100904 22:43:45 [Note] wampmysqld: Shutdown complete
100904 22:43:49 InnoDB: Started; log sequence number 0 43655
100904 22:43:49 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100904 22:43:49 [ERROR] Aborting
100904 22:43:49 InnoDB: Starting shutdown...
100904 22:43:52 InnoDB: Shutdown completed; log sequence number 0 43655
100904 22:43:52 [Note] wampmysqld: Shutdown complete
100905 8:23:24 InnoDB: Started; log sequence number 0 43655
100905 8:23:24 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 8:23:24 [ERROR] Aborting
100905 8:23:24 InnoDB: Starting shutdown...
100905 8:23:27 InnoDB: Shutdown completed; log sequence number 0 43655
100905 8:23:27 [Note] wampmysqld: Shutdown complete
100905 8:23:28 InnoDB: Started; log sequence number 0 43655
100905 8:23:28 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 8:23:28 [ERROR] Aborting
100905 8:23:28 InnoDB: Starting shutdown...
100905 8:23:30 InnoDB: Shutdown completed; log sequence number 0 43655
100905 8:23:30 [Note] wampmysqld: Shutdown complete
100905 8:41:35 InnoDB: Started; log sequence number 0 43655
100905 8:41:35 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 8:41:35 [ERROR] Aborting
100905 8:41:35 InnoDB: Starting shutdown...
100905 8:41:37 InnoDB: Shutdown completed; log sequence number 0 43655
100905 8:41:37 [Note] wampmysqld: Shutdown complete
100905 8:41:42 InnoDB: Started; log sequence number 0 43655
100905 8:41:42 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 8:41:42 [ERROR] Aborting
100905 8:41:42 InnoDB: Starting shutdown...
100905 8:41:45 InnoDB: Shutdown completed; log sequence number 0 43655
100905 8:41:45 [Note] wampmysqld: Shutdown complete
100905 8:47:15 InnoDB: Started; log sequence number 0 43655
100905 8:47:15 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 8:47:15 [ERROR] Aborting
100905 8:47:15 InnoDB: Starting shutdown...
100905 8:47:17 InnoDB: Shutdown completed; log sequence number 0 43655
100905 8:47:17 [Note] wampmysqld: Shutdown complete
100905 8:54:20 InnoDB: Started; log sequence number 0 43655
100905 8:54:20 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 8:54:20 [ERROR] Aborting
100905 8:54:20 InnoDB: Starting shutdown...
100905 8:54:23 InnoDB: Shutdown completed; log sequence number 0 43655
100905 8:54:23 [Note] wampmysqld: Shutdown complete
100905 8:54:53 InnoDB: Started; log sequence number 0 43655
100905 8:54:53 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 8:54:53 [ERROR] Aborting
100905 8:54:53 InnoDB: Starting shutdown...
100905 8:54:55 InnoDB: Shutdown completed; log sequence number 0 43655
100905 8:54:55 [Note] wampmysqld: Shutdown complete
100905 8:58:20 InnoDB: Started; log sequence number 0 43655
100905 8:58:20 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 8:58:20 [ERROR] Aborting
100905 8:58:20 InnoDB: Starting shutdown...
100905 8:58:22 InnoDB: Shutdown completed; log sequence number 0 43655
100905 8:58:22 [Note] wampmysqld: Shutdown complete
100905 8:59:57 InnoDB: Started; log sequence number 0 43655
100905 8:59:57 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 8:59:57 [ERROR] Aborting
100905 8:59:57 InnoDB: Starting shutdown...
100905 9:00:00 InnoDB: Shutdown completed; log sequence number 0 43655
100905 9:00:00 [Note] wampmysqld: Shutdown complete
100905 9:02:21 InnoDB: Started; log sequence number 0 43655
100905 9:02:21 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 9:02:21 [ERROR] Aborting
100905 9:02:21 InnoDB: Starting shutdown...
100905 9:02:23 InnoDB: Shutdown completed; log sequence number 0 43655
100905 9:02:23 [Note] wampmysqld: Shutdown complete
100905 9:02:29 InnoDB: Started; log sequence number 0 43655
100905 9:02:29 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 9:02:29 [ERROR] Aborting
100905 9:02:29 InnoDB: Starting shutdown...
100905 9:02:31 InnoDB: Shutdown completed; log sequence number 0 43655
100905 9:02:31 [Note] wampmysqld: Shutdown complete
100905 9:08:16 InnoDB: Started; log sequence number 0 43655
100905 9:08:16 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 9:08:16 [ERROR] Aborting
100905 9:08:16 InnoDB: Starting shutdown...
100905 9:08:18 InnoDB: Shutdown completed; log sequence number 0 43655
100905 9:08:18 [Note] wampmysqld: Shutdown complete
100905 9:08:54 InnoDB: Started; log sequence number 0 43655
100905 9:08:54 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 9:08:54 [ERROR] Aborting
100905 9:08:54 InnoDB: Starting shutdown...
100905 9:08:56 InnoDB: Shutdown completed; log sequence number 0 43655
100905 9:08:56 [Note] wampmysqld: Shutdown complete
100905 9:35:05 InnoDB: Started; log sequence number 0 43655
100905 9:35:05 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 9:35:05 [ERROR] Aborting
100905 9:35:05 InnoDB: Starting shutdown...
100905 9:35:08 InnoDB: Shutdown completed; log sequence number 0 43655
100905 9:35:08 [Note] wampmysqld: Shutdown complete
100905 9:38:08 InnoDB: Started; log sequence number 0 43655
100905 9:38:08 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 9:38:08 [ERROR] Aborting
100905 9:38:08 InnoDB: Starting shutdown...
100905 9:38:10 InnoDB: Shutdown completed; log sequence number 0 43655
100905 9:38:10 [Note] wampmysqld: Shutdown complete
100905 16:18:51 InnoDB: Started; log sequence number 0 43655
100905 16:18:52 [ERROR] Do you already have another mysqld server running on port: 3306 ?
100905 16:18:52 [ERROR] Aborting
100905 16:18:52 InnoDB: Starting shutdown...
100905 16:18:54 InnoDB: Shutdown completed; log sequence number 0 43655
100905 16:18:54 [Note] wampmysqld: Shutdown complete
經過分析是
3306端口被占用了,
1.以前安裝的mysql沒有卸載干淨
2.其他程序(如迅雷隨機獲取端口號)占用了3306端口
這樣就好辦了,只要在mysql配置文件把端口修改一下就可以了。