LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1413|回复: 2

在Debian中MySQL用户授权,localhost与127.0.0.1

[复制链接]
发表于 2005-11-16 16:00:37 | 显示全部楼层 |阅读模式
引自:(http://forum.java.sun.com/thread.jspa?threadID=670717&messageID=3921118)
localhost and 127.0.0.1 are not treated the same in MySQL. You need another GRANT statement for that user with "user@127.0.0.1" rather than "user@localhost" or "user@localhost.localdomain"

不知道大家遇见过没有,同一个用户和同一个数据库,在WinXP的PHP和Java下都可以使用,可是到了Linux(我只试过Debian)下,只有PHP能用,Java却不能用了。提示Access denied for user: 'root@localhost.localdomain',或者其它,看起来很古怪。
后来在Google,找到上面这个比较满意的答案,把问题解决了。
不过,我认为这应该与主机名的设置有关吧。不知道LinuxSir的高手有更满意的答案吗?
发表于 2005-11-17 11:50:43 | 显示全部楼层
看看Mysql自代的数据库中是否有你上面用的那个用户名
回复 支持 反对

使用道具 举报

发表于 2005-11-17 12:34:44 | 显示全部楼层
localhost是unix socket连接
127.0.0.1是TCP/IP连接
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表