mac mysqld停止-launch

sudo /usr/local/mysql/support-files/mysql.server stop // 停止

sudo /usr/local/mysql/support-files/mysql.server start // 启动

sudo /usr/local/mysql/support-files/mysql.server restart // 重启

重启MySQL提示MySQL server PID file could not be found!

Starting MySQL...The server quit without updating PID file (/usr/local/mysql/data/rekfan.pid).

1.可能是/usr/local/mysql/data/rekfan.pid文件没有写的权限

解决方法 :给予权限,执行

chown -R mysql:mysql /usr/local/mysql/data 

chmod -R 755 /usr/local/mysql/data

然后重新启动mysqld!

转自---

作者:Jack问
链接:https://www.jianshu.com/p/51551802a1ee
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

 

 

--  以上不好用的话,终极大招

转自

https://www.xiebruce.top/983.html

macOS服务管理 – launchd、launchctl、brew services详解

plist

/Library/LanuchDaemons 

/System/Library/LanuchDaemons

 

 launch进程加载后就会读这俩文件,    属性<key>RunAtLoad</key>         <true/> 的会自动启动

 

输入指定用户名密码登录后,会加载,以zhangsan为例子:

/Library/LaunchAgents 

/System/Library/LaunchAgents 

/User/zhangsan/Library/LaunchAgents (也就是 登录后看到的这个路径~/Library/LaunchAgents)

 

关闭

sudo launchctl unload /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

 

关于 stop unload、start load区别

 

unload load 后面参数是plist的路径

2而stop start后面是服务名 不含plist,例如mysql 就是 com.oracle.oss.mysql.mysqld,以 sudo launchctl list 这个命令显示的为准

  • launchctl start <label>: Starts the job. This is usually reserved just for testing or debugging a particular job.
  • launchctl stop <label>: Stops the job. Opposite of start, and it's possible that the job will immediately restart if the job is configured to stay running.

  • launchctl remove <label>: Removes the job from launchd, but asynchronously. It will not wait for the job to actually stop before returning, so no error handling on this one.

  • launchctl load <path>: Loads and starts the job as long as the job is not "disabled."
  • launchctl unload <path>: Stops and unloads the job. The job will still restart on the next login/reboot.

 

posted @ 2023-10-09 10:00  zhonghuahero  阅读(53)  评论(0编辑  收藏  举报