➜ python git:(master) ✗ brew install mysql
==> Downloading https://homebrew.bintray.com/bottles/mysql-5.7.21.high_sierra.bo
######################################################################## 100.0%
==> Pouring mysql-5.7.21.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/mysql/5.7.21/bin/mysqld --initialize-insecure --user=zcw -
==> Caveats
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
mysql -uroot 报错,因为没启动server
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.server start
➜ python git:(master) ✗ mysql.server start
Starting MySQL
. SUCCESS!
设置密码回答问题
python git:(master) ✗ mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No:
然后后一点点填写就好了
网友评论