Mysql
在 Windows 上關閉 MySQL
伙計們,
我在 Windows8 上執行 MySQL 以供我個人(休閒)使用。我正在嘗試確定是否有一種方法可以在我關閉 Windows8 電腦時自動**干淨地關閉 MySQL。**理想情況下,Windows 應該作為作業系統關閉序列的一部分自動停止 MySQL 服務。但我不確定它是否真的發生了。任何圍繞這個主題的想法/想法/建議將不勝感激!
附加資訊:目前我正在使用 .bat 腳本對 mysql Windows 服務進行“網路停止”。我在關閉電腦之前手動呼叫了這個 .bat 腳本。
謝謝。
如果您想手動控制它,這裡有一些建議
以管理員身份登錄到 Window 命令行 Shell 並執行它
C:\> net stop mysql
當提示返回時,MySQL 已關閉。
如果你關閉 Windows,MySQL 關閉的唯一證據就是錯誤日誌。
例子
在我的筆記型電腦上
- 我有適用於 Windows 的 MySQL 5.5.37
- 自 2014 年 12 月 17 日以來一直在上升
- 錯誤日誌文件名說
12/17/2014 11:09 AM 83,010 ROLAED3573-NYTD.err
- 我剛跑
net stop mysql
- 錯誤日誌文件名說
01/09/2015 02:02 PM 83,304 ROLAED3573-NYTD.err
從我的操作來看,MySQL 關閉在錯誤日誌的末尾寫入了 294 個字節。它寫了什麼?
150109 14:02:33 [Note] MySQL: Normal shutdown 150109 14:02:33 [Note] Event Scheduler: Purging the queue. 0 events 150109 14:02:33 InnoDB: Starting shutdown... 150109 14:02:34 InnoDB: Shutdown completed; log sequence number 10001663889 150109 14:02:34 [Note] MySQL: Shutdown complete
鑑於此輸出,我希望關閉在錯誤日誌的末尾有這些行。
更新 2015-01-09 14:47 EST
我剛跑了這個
C:\MySQL_5.5.37\data>net start mysql The MySQL service is starting. The MySQL service was started successfully. C:\MySQL_5.5.37\data>
錯誤日誌說
01/09/2015 02:34 PM 84,289 ROLAED3573-NYTD.err
這落在文件的底部
150109 14:34:48 [Note] Plugin 'FEDERATED' is disabled. 150109 14:34:48 InnoDB: The InnoDB memory heap is disabled 150109 14:34:48 InnoDB: Mutexes and rw_locks use Windows interlocked functions 150109 14:34:48 InnoDB: Compressed tables use zlib 1.2.3 150109 14:34:48 InnoDB: Initializing buffer pool, size = 1.0G 150109 14:34:48 InnoDB: Completed initialization of buffer pool 150109 14:34:48 InnoDB: highest supported file format is Barracuda. 150109 14:34:48 InnoDB: Waiting for the background threads to start 150109 14:34:49 InnoDB: 5.5.37 started; log sequence number 10001663889 150109 14:34:49 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 150109 14:34:49 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 150109 14:34:49 [Note] Server socket created on IP: '0.0.0.0'. 150109 14:34:50 [Note] Event Scheduler: Loaded 0 events 150109 14:34:50 [Note] MySQL: ready for connections. Version: '5.5.37-log' socket: '' port: 3306 MySQL Community Server (GPL)
我關閉了我的筆記型電腦
我啟動了我的筆記型電腦
錯誤日誌說
01/09/2015 02:40 PM 85,568 ROLAED3573-NYTD.err
這次寫了什麼?
150109 14:39:13 [Note] MySQL: Normal shutdown 150109 14:39:13 [Note] Event Scheduler: Purging the queue. 0 events 150109 14:39:13 InnoDB: Starting shutdown... 150109 14:39:13 InnoDB: Shutdown completed; log sequence number 10001663889 150109 14:39:13 [Note] MySQL: Shutdown complete 150109 14:40:04 [Note] Plugin 'FEDERATED' is disabled. 150109 14:40:04 InnoDB: The InnoDB memory heap is disabled 150109 14:40:04 InnoDB: Mutexes and rw_locks use Windows interlocked functions 150109 14:40:04 InnoDB: Compressed tables use zlib 1.2.3 150109 14:40:04 InnoDB: Initializing buffer pool, size = 1.0G 150109 14:40:04 InnoDB: Completed initialization of buffer pool 150109 14:40:04 InnoDB: highest supported file format is Barracuda. 150109 14:40:05 InnoDB: Waiting for the background threads to start 150109 14:40:06 InnoDB: 5.5.37 started; log sequence number 10001663889 150109 14:40:06 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 150109 14:40:06 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 150109 14:40:06 [Note] Server socket created on IP: '0.0.0.0'. 150109 14:40:06 [Note] Event Scheduler: Loaded 0 events 150109 14:40:06 [Note] MySQL: ready for connections. Version: '5.5.37-log' socket: '' port: 3306 MySQL Community Server (GPL)
如錯誤日誌末尾所示,它在下午 2:39 執行了乾淨關閉。當 Windows 啟動時,MySQL 又恢復了。