1.修改文件目录为/etc/my.cnf的文件;

  在[mysqld]的段中加上一句:skip-grant-tables,保存文件重启数据库;
  例如:
  [mysqld]
  skip-grant-tables
  datadir=/var/lib/mysql
  socket=/var/lib/mysql/mysql.sock
  user=mysql
  # Disabling symbolic-links is recommended to prevent assorted security risks
  symbolic-links=

2。修改密码:

centos6.5 mysql忘记登入密码

3,把/etc/my.cnf文件内容修改回来,重启数据库

注意:步骤三的时候:使用:update mysql.user set authentication_string=password("你的密码大写字母和数字尽量多而复杂") where user="root";(不要去掉;)

相关文章:

  • 2022-02-07
  • 2021-08-09
  • 2022-12-23
  • 2018-03-12
  • 2019-12-10
  • 2022-02-26
  • 2021-11-28
  • 2021-11-08
猜你喜欢
  • 2022-02-10
  • 2021-11-17
  • 2021-05-21
  • 2021-06-09
  • 2021-10-10
  • 2021-10-02
相关资源
相似解决方案