前提唠叨:刚学了mysql准备在自己的虚拟机上回家玩玩,结果mysql就立马给我一个下马威,拒绝连接root用户,首先呢,我耐心的在网上寻找解决之道,确实发现很多,但归纳起来也就三四种,再折腾了2个多小时挨个试完之后发现,没有一个可以解决我这个问题。过了两天碰到老师我向他咨询了一下,结果回来立马就解决了!牛!再啰嗦两句,首先你得是跟我相似或者一样的应用环境,这个很重要,不同的环境下结果可能呈现万般不同;然后呢,我这是只是快速的解决进入mysql的问题,至于进去之后你要不要再添设密码以加强安全什么的不在今天所说之列,闲话稍许,下面是正题。环境:RedHat企业版5.9
用户:root
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user "root"@"localhost" (using password: NO)
1、这时我想那我添设个初始密码呗!话说初始化之后应该是可以匿名进入的才对啊!
[root@localhost ~]# mysqladmin -hlocalhost -uroot password"123"
mysqladmin: connect to server at "localhost" failed
error: "Access denied for user "root"@"localhost" (using password: NO)"
2、设置失败,既然这样我只能试一试老师说到的mysql的配置文件
[root@localhost ~]# vim /etc/my.cnf
[mysqld]
skip-grant-table //这句表达的意思呢是“跳过授权表,即无密码直接进入啦”
3、重启服务
[root@localhost ~]# service mysqld restart
停止 mysqld: [确定]
启动 mysqld: [确定]
4、再次进入
[root@localhost ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.0.95 Source distributionCopyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type "help;" or "h" for help. Type "c" to clear the current input statement.mysql>嘿嘿,终于看到这个向右的小箭头了!虽然简单,但若能帮到某人,我会很开心的。
更多相关阅读:MySQL ERROR 1045 (28000): Access denied for user "root"@"localhost" http://www.linuxidc.com/Linux/2008-08/15067.htm解决MySQL安装时1045错误的方法 http://www.linuxidc.com/Linux/2010-04/25472.htmLinux下MySQL远程连接提示ERROR 1045 (28000) http://www.linuxidc.com/Linux/2012-12/76269.htmMySQL出现1045错误服务找不到路径的解决 http://www.linuxidc.com/Linux/2008-08/14702.htmUbuntu使用技巧之MySQL释义Oracle 11r2中并行执行相关参数相关资讯 MySQL报错 MySQL error1045
- MySQL报错: Unknown character (05/01/2015 17:25:26)
- MySQL启动报错解决一例 (05/25/2014 07:32:10)
| - MySQL报错:master and slave have (02/28/2015 20:01:16)
|
本文评论 查看全部评论 (0)