您好,欢迎访问一九零五行业门户网

Linux rhel Access denied for user ’root’

access denied for user ’root’@’localhost’ (using password: yes) 今天在rhel5.5 下安装了一个mysql数据库使用的是yum 的安装方式 安装过程 参照http://blog.csdn.net/xiamizy/article/details/2072525 安装完成后用root用户进行登录 mysql -uroot -p1
access denied for user ’root’@’localhost’ (using password: yes)
今天在rhel5.5 下安装了一个mysql数据库使用的是yum 的安装方式
安装过程 参照 http://blog.csdn.net/xiamizy/article/details/2072525
安装完成后用root用户进行登录
mysql -uroot -p123456 
总是报 access denied for user ’root’@’localhost’ (using password: yes)的错误
找了好长时间终于发现了错误 
在给root用户更改密码的时候应该是这样写
update mysql.user set password=password('123456') where user='root';
我错误的写成了 update mysql.user set password='123456' where user='root';
弄的我很是郁闷
之后又不能登录数据库, 怎么办呢?
用mysqld_safe 模式启动数据库
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
使用正确的语句 
update mysql.user set password=password('123456') where user='root';
# quit
重新登录 mysql -uroot -p123456
ok 登录成功
注意如果在密码中使用特殊字符,可能不会成功。我在密码使用$的时候发现不能登录。具体怎么解决没有去研究,如果有谁知道,希望给补充一下。
记下这个错误希望能帮助遇到同样问题的人
其它类似信息

推荐信息