代码改变世界

mac 下安装 mariadb

2014-05-15 13:47  萧 云  阅读(1175)  评论(0编辑  收藏  举报

通过brew 安装:

brew install mariadb

初始化数据库

cd /usr/local/Cellar/mariadb/10.0.10/scripts
mysql_install_db --user=`root` --basedir="$(brew --prefix mariadb)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

 开启自启动

cp $(brew --prefix mariadb)/homebrew.mxcl.mariadb.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist

如果mysql未启动,出现

 Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")

可用命令: 

 

参考:

http://www.foolegg.com/how-to-setup-a-nginx-mariadb-php-mnmp-server-on-mac-osx/#title