Mac下brew安装MySQL5.7 设置默认密码

1、进入到MySQL安转bin目录下:

cd /opt/homebrew/Cellar/[email protected]/5.7.41/bin

2、启动安全模式,并进入MySQL:

mysqld_safe --skip-grant-tables

mysql -u root -p

3、修改root账户密码:

update mysql.user set authentication_string=PASSWORD('123456') where user='root';

flush privileges;

exit

4、再次进入MySQL,重置密码:

mysql -u root -p 123456

set password for root@localhost=password('123456');

你可能感兴趣的:(MySQL,mysql,数据库)