Access denied for user 'root'@'localhost' (using password: YES)

今天在centos上安装mysql,添加用户一直报Access denied for user 'root'@'localhost' (using password: YES),

试过了网上各种方法,

mysql -uroot -p

同样都是无济于事,后来我打开mysql的配置文件

/etc/my.cnf 

中间一行user:mysql

mysql -u mysql

就可以正常使用了

原文地址:https://www.cnblogs.com/river-lee/p/4356607.html