mysql 创建用户后无法登录 本帖最后由 diyle 于 2011-08-11 21:55:16 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 grant all privileges on *.* to abcd@'%' identified by '123456';执行一下上面这句就可以了 用ROOT登录上去检查一下这个用户的权限show grants FOR 'abcd'@'localhost' 运行结果:mysql> grant all privileges on *.* to abcd@'%' identified by '123456';Query OK, 0 rows affected (0.08 sec)执行后,还是连不上,继续追问 mysql> show grants FOR 'abcd'@'localhost';ERROR 1141 (42000): There is no such grant defined for user 'abcd' on host 'localhost'为啥米? 删了这条记录,重新创建一个吧,不知道你怎么创建的。grant all on database.table to user@'%' identified by 'password' 使用 root 登录看看如下语句的结果:select user, host from mysql.user; 我又重新创建了一次,上次是用phpmyadmin直接建的,这次是用mysql命令如下:mysql> CREATE USER 'abcd'@'%' IDENTIFIED BY '123456';Query OK, 0 rows affected (0.02 sec)mysql> grant all privileges on *.* to 'abcd'@'%';Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> select user,host from mysql.user;+------+-----------+| user | host |+------+-----------+| abcd | % || root | 127.0.0.1 || | localhost || pma | localhost || root | localhost |+------+-----------+5 rows in set (0.00 sec)连接依然报Access denied for user 'abcd'@'localhost'我又重新修改了下密码mysql> update user set password=password('123456') where user='abcd';Query OK, 1 row affected (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 0mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)还不行。mysql> CREATE USER 'abcd'@'%' IDENTIFIED BY '123456'; CREATE USER 'abcd'@'192.167.0.6' IDENTIFIED BY '123456';grant all privileges on *.* to 'abcd'@'%';试试 orCREATE USER 'abcd'@'localhost' IDENTIFIED BY '123456'; 咦,这样可以,咋%不行。如何使任意host都能连呢 你的$hostname = "localhost";修改为你的服务器IP or$hostname = "你的服务器名" 这个问题让我搁置了好久,闲来重新装了下amp.久试发现是mysql版本的问题。一直没搞明白mysql.5.5.+的版本默认不支持tcp/ip连接?我重新下了个5.1.58 社区版的,一切ok!好了,散分结贴! 一条“稍”复杂的sql 求改编一下 现在有点慢。。。。 mysql的MD5加密后的字符能不能设定长度 求MYSQL多表联合查询方案 数据库查询的疑惑 复杂的删除重复记录问题 MYSQL安装失败 mysql 初学,问个小问题 用VB怎么向mysql存储图片,我用下面的语句,出现的错误是...是什么原因?急!!!!!!!!! 求教了....字符串包含问题! 大家搭建过Mysql分布式集群吗 postgresql 存储过程中调用外部c函数 导出千万条数据,对数据库的影响?
运行结果:
mysql> grant all privileges on *.* to abcd@'%' identified by '123456';
Query OK, 0 rows affected (0.08 sec)执行后,还是连不上,继续追问
ERROR 1141 (42000): There is no such grant defined for user 'abcd' on host 'localhost'为啥米?
grant all on database.table to user@'%' identified by 'password'
select user, host from mysql.user;
我又重新创建了一次,上次是用phpmyadmin直接建的,这次是用mysql命令如下:mysql> CREATE USER 'abcd'@'%' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.02 sec)mysql> grant all privileges on *.* to 'abcd'@'%';
Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)mysql> select user,host from mysql.user;
+------+-----------+
| user | host |
+------+-----------+
| abcd | % |
| root | 127.0.0.1 |
| | localhost |
| pma | localhost |
| root | localhost |
+------+-----------+
5 rows in set (0.00 sec)连接依然报Access denied for user 'abcd'@'localhost'
我又重新修改了下密码
mysql> update user set password=password('123456') where user='abcd';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)还不行。mysql> CREATE USER 'abcd'@'%' IDENTIFIED BY '123456';
grant all privileges on *.* to 'abcd'@'%';
试试
CREATE USER 'abcd'@'localhost' IDENTIFIED BY '123456';
咦,这样可以,咋%不行。如何使任意host都能连呢
$hostname = "你的服务器名"
我重新下了个5.1.58 社区版的,一切ok!
好了,散分结贴!