mac下使用brew安装mysql

原创
2016/07/28 12:47
阅读数 719

##【安装】

brew install mysql

下载完成以后需要编译,此时需要占用很大的cpu,风扇会狂叫,没事,完了就好 #使用

【启动】

sudo mysql.server start

此时可能会报错:

Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/xxxxx.local.pid).

这是由于权限问题造成的 可以通用一下命令修改权限

sudo chmod -R a+rwx /usr/local/var/mysql

再执行

sudo mysql.server start

显示

Starting MySQL
. SUCCESS!

启动成功

【配置】

启动后,需要对mysql进行一些配置,可以通过以下命令进行初始化:

/usr/local/opt/mysql/bin/mysql_secure_installation

【关闭】

sudo mysql.server stop

【重启】

sudo mysql.server restart

#关于my.cnf 通过brew安装的mysql似乎默认并没有使用my.cnf,直接使用默认配置启动 ###my.cnf文件位置

mysql --help | grep 'Default options' -A 1
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf

mysql会按照以上情况顺序加载mysql,所以就按需建立一个吧

##validate_password mysql5.7(5.6应该也有,具体从哪个版本开始,不太清楚)默认开启了validate_password插件。但在本地开发环境中,为了尽可能的方便,我们是不需要开启它的,此时可以在my.cnf中配置,对其进行关闭

[mysqld]
validate_password=off
展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部