急救:MySQL登陆密码问题!!!!!!

zgtt 2003-03-06 11:23:11
我执行的过程:
C:\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 4.0.10-gamma-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql
Database changed
mysql> select host,user,password from user;
+-----------+------+----------+
| host | user | password |
+-----------+------+----------+
| localhost | root | 123 |
| % | root | 123 |
| localhost | | |
| % | | |
+-----------+------+----------+
4 rows in set (0.05 sec)

mysql> update user set password="1234" where user="root" and host="%";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye

C:\mysql\bin>mysql -u root -p
Enter password: ****
ERROR 1045: Access denied for user: 'root@127.0.0.1' (Using password: YES)


C:\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10 to server version: 4.0.10-gamma-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql
Database changed
mysql> select host,user,password from user;
+-----------+------+----------+
| host | user | password |
+-----------+------+----------+
| localhost | root | 123 |
| % | root | 1234 |
| localhost | | |
| % | | |
+-----------+------+----------+
4 rows in set (0.00 sec)
请高手指教,为什么我该了ROOT的密码后,用mysql -u root -p命令,输入密码1234,还是提示ERROR 1045: Access denied for user: 'root@127.0.0.1' (Using password: YES)错误啊.
我该怎么做呢?实验了好多次了.都是提示这个错误.
谢谢.
...全文
203 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
showmetheway 2003-06-23
  • 打赏
  • 举报
回复
请问在刚装好的mysql中, user 表中的 host 字段等于 ‘%’是什么意思?
zgtt 2003-03-19
  • 打赏
  • 举报
回复
TO:allan1031(岚月影)
我也注意到了.哎.
allan1031 2003-03-09
  • 打赏
  • 举报
回复
这几天忙着做课程设计,和同学一起用JAVA+MYSQL+LINUX
做的差不多了,同学突然弄丢了密码---我们在一开始就把MYSQL表中的user=“localhost",password= "" 给删除了,因为我还是挺注意保密的^_^
---,因为他在测试我的代码的时候换了密码,所以遇到了这个问题我也没办法---创建表单的时候太麻烦了,懒得重新安装。
然后在想啊想的闷出了一个损招。
MYSQL的密码和用户信息不都放在MYSQL数据库中的USER表中的吗?于是...
我的MYSQL本来是装在/user/mysql 下的,然后我就重新的安装了一次(当然不是这台已经安装了但弄丢了密码的机器,是另外一台,安装目录不变---其实我后来测试了下,改变了目录也没关系。),然后把这个新的数据库中的MYSQL数据库中的USER直接拷贝了过去,覆盖了原来的文件...居然还能用...
我的天啊,难道MYSQL在设计的时候没考虑到这点的吗,这样都可以做到“略过”用户名和密码的话,我是不知道以后我还敢不敢用MYSQL做东西了。


----后来我在WINDOWS2000下也测试了以上过程,结果很惊奇的发现原来在WINDOWS2000下,MYSQL还是很让我们惊奇的“拥有了”以上的功能。
zgtt 2003-03-07
  • 打赏
  • 举报
回复
没有人帮助吗?:(
zgtt 2003-03-07
  • 打赏
  • 举报
回复
我删除三个用户,只留下一个用户后:
mysql> select host,user,password from user;
+-----------+------+----------+
| host | user | password |
+-----------+------+----------+
| localhost | root | 123 |
+-----------+------+----------+
1 row in set (0.00 sec)
推出MYSQL后,在次进入时,就进不去了.:(
C:\mysql\bin>mysql -h localhost -u root -p
Enter password: ***
ERROR 1130: Host '127.0.0.1' is not allowed to connect to this MySQL server

别的也不行了.

怎么办啊?
C:\mysql\bin>mysql -h localhost -u root
ERROR 1130: Host '127.0.0.1' is not allowed to connect to this MySQL server
C:\mysql\bin>mysql -u root
ERROR 1130: Host '127.0.0.1' is not allowed to connect to this MySQL server
:(
请高手指点一下.谢谢.
zgtt 2003-03-07
  • 打赏
  • 举报
回复
谢谢大家关心
我马上试一下
TO ks117(轻云掠过) 那个帖子呢?
loveflea 2003-03-07
  • 打赏
  • 举报
回复
我得也新手,我只流了一个localhost 的 root 用户,然后再添的用户。
密码字段要用password()加密,否则对比不上
loveflea 2003-03-07
  • 打赏
  • 举报
回复
update user set password=password("1234") where user="root" and host="%";
ks117 2003-03-07
  • 打赏
  • 举报
回复
你前面的说改用户密码好象没错,我按照中文手册看了下,出现那错误,我也不知道
我没按你那样做,我刚发了帖子,你可以去看看我的做法

至于后面的错误<1130>,那就是你现在没有连上mysql server ,你要重新连。


我也是刚学,不知道说的对不对,一起探讨探讨!
shuixin13 2003-03-07
  • 打赏
  • 举报
回复
呵呵
没法了,
删除mysql 数据库吧
然后重装一下 MySQL 系统,

更新密码应该用 PASSWORD() 函数加密
如下所示:
password = Password('123')
zgtt 2003-03-07
  • 打赏
  • 举报
回复
ERROR 1130: Host '127.0.0.1' is not allowed to connect to this MySQL server
是什么错误呢>?
我那里做的不对呢?如何解决?
请高手指教!!!
zgtt 2003-03-07
  • 打赏
  • 举报
回复
提示错误,还是不行啊:(
C:\mysql\bin>mysqladmin -u root status
mysqladmin: connect to server at 'localhost' failed
error: 'Host '127.0.0.1' is not allowed to connect to this MySQL server'

C:\mysql\bin>mysqladmin -u root reload
mysqladmin: connect to server at 'localhost' failed
error: 'Host '127.0.0.1' is not allowed to connect to this MySQL server'

bombshell 2003-03-07
  • 打赏
  • 举报
回复
重新加载一下授权表
C:\mysql\bin>mysqladmin -u root status
C:\mysql\bin>mysqladmin -u root reload

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧