redhat5下安装MySQL-5.6,默认密码无法进入的解决办法

redhat5下安装MySQL-5.6,默认装完没有设置mysql的密码,按理说应该mysql的root用户的默认密码为空,但是默认空密码无法进入,报错信息如下:

Java代码 收藏代码
  1. Access denied for user 'root'@'localhost' (using password: NO)  


各种密码尝试都无法进入mysql。经网上查找资料终于找到解决办法。

解决办法:
找到my.cnf文件,编辑文件,添加如下内容:
skip-grant-tables
    skip-networking

红色字体为新添加。

Java代码 收藏代码
  1. [root@localhost /]# vi /usr/my.cnf  

  2. # For advice on how to change settings please see  

  3. # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

  4. [mysqld]  

  5. [color=red]  

  6.  skip-grant-tables  

  7.  skip-networking  

  8. [/color]  

  9. # Remove leading # and set to the amount of RAM for the most important data  

  10. # cache in MySQL. Start at 70% of total RAM for dedicated server, else10%.  

  11. # innodb_buffer_pool_size = 128M  

  12. # Remove leading # to turn on a very important data integrity option: logging  

  13. # changes to the binary log between backups.  

  14. # log_bin  

  15. # These are commonly set, remove the # and set as required.  

  16. # basedir = .....  




重新启动:/etc/init.d/mysql restart
启动OK后,mysql的root用户默认空密码可以正常进入。


转自http://jadethao.iteye.com/blog/1922991

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章