Mysql5.7忘记root密码及mysql5.7修改root密码的方法

更改密码:

1

mysql> update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';

1

2

mysql> flush privileges;

mysql> quit;

修改完毕。重启

从最新版本的linux系统开始,默认的是 Mariadb而不是mysql!

扫描二维码关注公众号,回复: 194072 查看本文章

使用系统自带的repos安装很简单:

yum install mariadb mariadb-server

systemctl start mariadb ==> 启动mariadb

systemctl enable mariadb ==> 开机自启动

mysql_secure_installation ==> 设置 root密码等相关

mysql -uroot -p123456 ==> 测试登录!

结束! Author: [email protected]

猜你喜欢

转载自my.oschina.net/u/195935/blog/1603552