mysql
軟體開發隨筆

MySQL server 在 Mac 上關不掉的問題

FB公開社團 Larry的午茶時光
加入不需審核,歡迎讀者加入~
我的IG帳號: larry.time.taste。剛剛起步,歡迎大家追蹤~

圖片來源 https://zh.wikipedia.org/wiki/MySQL

這兩天一直在處理一個很詭異的問題,如題:MySQL server 在 Mac 上關不掉。試了直接砍 process,不行,系統會產生新的 mysql process. 搜尋了不少文章後,才發現:
https://blog.yorkxin.org/posts/2011/08/04/osx-launch-daemon-agent/

由上面連結得知,Mac 開機/登入時的 services 有分:Launch Daemon, Launch Agent. Launch Daemon 在開機時動作, Launch Agent 在使用者登入時動作。

到底什麼是 Launch Daemon 呢?其實就是以下這些路徑下的 plist (property list) files:
/System/Library/LaunchDaemons
/Library/LaunchDaemons

系統在開機時會 load 上述路徑的 plist files, 然後要特別注意你的 plist file 是否有 KeepAlive, RunAtLoad 兩個 tag, 如果你不希望該 service keep alive 或 run at load 的話,請做適當的設定。

上面連結也有提到 Launch Agent plist file 的路徑:
/System/Library/LaunchAgents
/Library/LaunchAgents
~/Library/LaunchAgents

總之可以看一下上述幾個路徑底下的 plist file 和其中的設定,像是 mysql 的 plist file 就是在 /Library/LaunchDaemons, 如底下連結所敘:
https://dev.mysql.com/doc/refman/5.1/en/osx-installation-launchd.html

因為 Larry 將 mysql plist file 刪掉後,再重開機,MySQL server 關不掉的問題就不會再犯了,所以就沒有繼續實驗下去。不過照上文推斷,MySQL server 關不掉的問題應該在裝 MySQL 客戶端工具時就一直存在了…

FB公開社團 Larry的午茶時光
加入不需審核,歡迎讀者加入~
我的IG帳號: larry.time.taste。剛剛起步,歡迎大家追蹤~