centos6.5 mysql忘记登入密码


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。修改密码:

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

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM