mac mysql 安装

mac下进行web开发, mysql算是必备程序了. 

1. 如何安装mysql? 

brew install mysql

2. 如何启动mysql? 

mysqld &
mysql.server start

3. 如何让mysql开机自启动

mkdir -p ~/Library/LaunchAgents
cp `brew --prefix mysql`/*.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/*.plist

4. 重启后, 测试是否成功

mysql -uyour_username -pyour_password

5. 如果失败了: 

ls `brew --prefix mysql`/*.err

# 如果有 *.err, 删除. 重启机器. 
# 如果没有. 全部加入sudo执行步骤3. 

 

refer: 

http://segmentfault.com/q/1010000000212656

http://arcoleo.org/dsawiki/Wiki.jsp?page=Autostart%20MySQL%20on%20Mac

http://stackoverflow.com/questions/8014500/autostart-mysql-on-boot-from-terminal

 

posted @ 2014-11-05 13:10  代码会说话  阅读(196)  评论(0编辑  收藏  举报