mysql初始密码忘记
mysql密码忘记
mysql重置密码
vim /etc/my.cf
[mysqld]
skip-grant-tables
:wq
systemctl restart mysqld.service
mysql -uroot -p #提示输入密码直接回车
update mysql.user set authentication_string=password('123456') where User="root" and Host="localhost";
flush privileges;
grant all on *.* to 'root'@'localhost' identified by '123456' with grant option;
vim /etc/my.cf
# 删除/注释
skip-grant-tables
# 保存退出
:wq
systemctl restart mysqld.service
mysql -uroot -p
# 输入密码
123456