brew安装mysql,以及可能遇到的问题

通过brew来安装homebrew

brew install mysql

等待下载完成;

mysql.server start执行启动mysql服务

如果启动失败可以使用

brew services start mysql命令开启mysql服务

brew services stop mysql 命令关闭mysql服务

mysql_secure_installation命令进行配置mysql密码等设置

注意密码等级尽量选择low,如果不连公网使用的话。如果密码等级输入错误想要修改

出现以下错误

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements。

解决办法

执行以下命令

mysqld --skip-grant-tables

新建命令行

命令行输入mysql 直接进入mysql界面

mysql> set global validate_password.policy=0;		//修改密码等级为low

mysql>  set global validate_password.length=1;		//设置密码长度
#注意这个命令适用于mysql 8以上版本

基本上默认yes,除了允许远程访问no;

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
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
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.


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

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

最后启动就行。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值