brew services start mysql # 重启 brew services restart mysql # 停止 brew services stop mysql
Or, if you don’t want/need a background service you can just run: mysql.server start
1 2 3 4 5 6 7
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: y
1 2 3 4 5 6 7 8 9 10 11 12 13 14
There are three levels of password validation policy:
LOW Length >= 8 #长度大于等于8 MEDIUM Length >= 8, numeric, mixed case, and special characters #长度大于等于8，数字、大小写字母、特殊符号 STRONG Length >= 8, numeric, mixed case, special characters and dictionary file #长度大于等于8，数字、大小写字母、特殊符号和字典文件（慎选！）
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1 Please set the password for root here.
New password: （输入你的密码） Re-enter new password: （再次输入你的密码）
Estimated strength of the password: 50 #密码强度 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
1 2 3 4 5
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success.
1 2 3 4
Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y Success.
1 2 3 4 5 6 7 8
By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success.
- Removing privileges on test database... Success.
1 2 3 4 5 6 7
Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y #是否重新加载权限表 Success.
Your password does not satisfy the current policy requirements：