ioan

一段时间没有用mysql数据库,今天突然需要使用,结果忘记密码,google了下找到的解决方法,就顺便记录下,下次碰到就不需要这么麻烦了

1、输入命令  cat /etc/mysql/debian.cnf 

 

 

2、使用账号 debian-sys-maint 账号登录mysql密码为 debian.cnf 中password 值(# password 值每个人的情况不一样,根据实际情况),在切换到mysql

 

3、修改root账号密码(自己方便修改为123456了)

 update mysql.user set authentication_string=password(\'123456\') where user=\'root\' and Host=\'localhost\';

update user set plugin=\'mysql_native_password\';

flush privileges;

 

 4、修改密码后登录

mysql -u root -p

 

分类:

技术点:

相关文章:

  • 2021-05-06
  • 2021-08-17
  • 2021-08-24
  • 2021-09-21
  • 2022-02-10
  • 2021-10-07
猜你喜欢
  • 2021-06-07
  • 2021-05-06
  • 2021-09-02
  • 2021-09-21
  • 2021-10-06
  • 2021-05-29
  • 2021-09-27
相关资源
相似解决方案