LinuxSir.cn,穿越时空的Linuxsir!

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

arch 0.8 安装mysql 访问出现问题 请大伙帮忙解决 [已解决]

[复制链接]
发表于 2008-2-15 17:24:01 | 显示全部楼层 |阅读模式
arch 0.8 安装mysql 访问出现问题 请大伙帮忙解决

mysql安装完成后(分别用了5.0.37    5.0.45)
使用:
#mysql -u root -p 可以进入mysql
但是用:
#mysql -h 127.0.0.1 -u root -p 无法进入

[root@demon /]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.37 Source distribution
mysql> quit
Bye
[root@demon /]# mysql -h 127.0.0.1 -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

我在baidu google找了半天也没有个说明白的,
有说在my.cnf的mysqld段加入skip-name-resolve
但是我加了.还是不好使
我在mysql里也执行了:
GRANT SELECT,INSERT,UPDATE,DELETE ON *.* TO root@192.168.1.20 identified by 'ps';
问题依旧。我都正两天了.那位大哥帮我看看.
发表于 2008-2-15 19:14:51 | 显示全部楼层
试过#mysql -h localhost -u root -p没有?或者,你是不是把/etc/hosts/里的localhost给去掉了?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-2-15 22:44:31 | 显示全部楼层
Post by zlowly;1816477
试过#mysql -h localhost -u root -p没有?或者,你是不是把/etc/hosts/里的localhost给去掉了?


to:zlowly
          thanks

# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1               localhost.localdomain   localhost
127.0.0.1               demon                          localhost
# End of file


我按你说的试 用localhost可以上去.但用127.0.0.1和192.168.1.20[本机ip]都还是老样子
[mysql@demon root]$ mysql -h localhost -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.37 Source distribution
mysql> quit
Bye
[mysql@demon root]$ mysql -h 127.0.0.1 -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
[mysql@demon root]$
[mysql@demon root]$ mysql -h 192.168.1.20 -u root -p
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
[mysql@demon root]$

#ArchLinux的ip是:192.168.1.20
回复 支持 反对

使用道具 举报

发表于 2008-2-16 00:35:26 | 显示全部楼层
那就应该是Tcpwarpper阻挡了,编辑/etc/hosts.allow,加上这两行
mysqld: 127.0.0.1
mysqld: 192.168.1.20
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-2-16 09:01:38 | 显示全部楼层
Post by zlowly;1816564
那就应该是Tcpwarpper阻挡了,编辑/etc/hosts.allow,加上这两行
mysqld: 127.0.0.1
mysqld: 192.168.1.20


# /etc/hosts.allow
# anybody can
sshd : ALL: ALLOW
mysqld: ALL : ALLOW
# End of file


to:zlowly
     
     谢谢你的帮助,我的问题解决了
回复 支持 反对

使用道具 举报

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

本版积分规则

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