mac 安装mysql
1. 安装homebrew
2. 用brew 安装mysql
执行brew install mysql
,会出现类似的提示:
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -uroot
To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don't want/need a background service you can just run:
mysql.server start
3. 之后我们按照提示 执行 mysql_secure_installation
发现如下错误
Securing the MySQL server deployment.
Enter password for user root:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
这个错误的原因是我们没有开启mysql
4. 开启mysql 服务
执行mysql.server start
会提示 starting mysql, success.
5. 继续执行mysql_secure_installation
会提示你输入root 用户的password,还有其他一些的提示。