Mac下Mysql的启停及自启动方法

dhso
2017/10/16 09:27
统计中

Mac Mysql 启停命令

mysql.server start
mysql.server stop
mysql.server restart

Mac Mysql自启动配置

  • 用brew安装的可以通过以下语句查看安装目录
brew --prefix mysql
  • 从安装目录下找到homebrew.mxcl.mysql.plist文件复制到~/Library/LaunchAgents目录下
cp /usr/local/opt/mysql/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  • 设置自启动
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  • 如果不是brew命令安装的,没有homebrew.mxcl.mysql.plist文件,则自己新建如下,再按照步骤执行
<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  
<plist version="1.0">  
   <dict>  
     <key>KeepAlive</key>  
     <true/>  
     <key>Label</key>  
     <string>com.mysql.mysqld</string>  
     <key>ProgramArguments</key>  
     <array>  
         <string>/usr/local/mysql/bin/mysqld_safe</string>  
         <string>--user=root</string>  
     </array>    
   </dict>  
</plist>

本文为 dhso 原创

发布在 http://blog.minws.com/macxia-mysqlde-qi-ting-ji-zi-qi-dong-fang-fa/

如有转载,请标明来源!

作者信息
姓名:dhso
热评文章
最新评论
文章概览