美文网首页
Mac 下安装 Mysql

Mac 下安装 Mysql

作者: tangseng233 | 来源:发表于2019-06-01 19:42 被阅读0次

<center> mysql安装教程 for mac

1.确认brew可用

brew doctor  //诊断
brew update  //更新

2. 安装mysql

brew install mysql

3.安全性设置

启动mysql
mysql.server start
安全性设置
mysql_secure_installation
执行上述命令后,按步骤设置配置
Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT 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 component?

Press y|Y for Yes, any other key for No: y   //是否启用密码控件(是)

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0   //三种密码强度 选择0 LOW
Please set the password for root here.

New password:         //设置密码

Re-enter new password:   //再次确认

Estimated strength of the password: 50    //密码强度为50
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : N   //再添加密码 (否)
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.   //通常mysql会有一个匿名账户之类的

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y  //删除匿名账户(是)
Success.


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) : n  //不允许root远程登录?(否)

 ... skipping.
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.

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.  //重新加载权限(是)

All done!  
测试密码
mysql -u root -p
password: ******

4.设置开机自启

#停止background启动的mysql
mysql.server stop  

# 启动 mysql, 并设置为开机启动
brew services start mysql
# 关闭 mysql
brew services stop mysql
# 重启 mysql
brew services restart mysql

相关文章

网友评论

      本文标题:Mac 下安装 Mysql

      本文链接:https://www.haomeiwen.com/subject/zlaatctx.html