Mysql-Mac安装(brew)

安装Mysql

brew install mysql

等待安装成功会提示信息如下：

We've installed your MySQL database without a root password. To secure it run: mysql_secure_installationTo connect run: mysql -urootA "/etc/my.cnf" from another install may interfere with a Homebrew-builtserver starting up correctly.To have launchd start mysql now and restart at login: brew services start mysqlOr, if you don't want/need a background service you can just run: mysql.server start

初始化root 密码

Securing the MySQL server deployment.Connecting to MySQL using a blank password.VALIDATE PASSWORD PLUGIN can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to setonly those passwords which aresecure enough. Would you liketo setup VALIDATEPASSWORDplugin?# 是否确认设置密码插件Press y|Y for Yes, any other keyforNo: yThere are three levelsofpasswordvalidationpolicy:LOWLength >= 8MEDIUMLength >= 8, numeric, mixed case, and special charactersSTRONG Length >= 8, numeric, mixed case, special charactersand dictionary file# 确定密码策略Please enter 0 = LOW, 1 = MEDIUMand2 = STRONG: 2Please set the passwordfor root here.# 输入新的密码Newpassword:# 重新输入新的密码Re-enter newpassword:Estimated strength of the password: 100Do you wish to continue with the password provided?(Press y|Y for Yes, any other keyforNo) : yBydefault, a MySQL installation has an anonymous user,allowing anyone tologinto MySQL withouthavingto havea useraccount created for them. This is intended onlyfortesting, andto make the installation go a bit smoother.# For advice on how tochangesettings please seeYou should remove them before moving into a productionenvironment.# 是否移除任意用户登陆Remove anonymous users? (Press y|Y for Yes, any other keyforNo) : ySuccess.Normally, root should only be allowed toconnectfrom'localhost'. This ensures that someone cannot guess atthe root passwordfrom the network.# 禁止root 远程登录Disallow root login remotely? (Press y|Y for Yes, any other keyforNo) : n ... skipping.Bydefault, MySQL comes with a database named 'test' thatanyone can access. This is also intended onlyfor testing,and should be removed before moving into a productionenvironment.# 移除测试数据库Remove testdatabaseandaccessto it? (Press y|Y for Yes, any other keyforNo) : y - Dropping test database...Success. - Removing privilegesontest database...Success.Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.# 重新加载策略Reload privilege tablesnow? (Press y|Y for Yes, any other keyforNo) : ySuccess.All done!