在mysql中,数据库表是有权限的。 在mysql.user表中,有三个字段host,user,password. host是登陆时的主机名,user是登陆用户名,password是密码。我觉得你出现那样的状况,在mysql.user表中,应该有两条记录是: host user password 127.0.0.1 root localhost root 对于这两个用户的权限是不同的,你对lcoalhost的root没有赋予访问其他数据库表的权限。赋予权限的语句: grant all on *.* to root@% identified by 'password'
在mysql.user表中,有三个字段host,user,password.
host是登陆时的主机名,user是登陆用户名,password是密码。我觉得你出现那样的状况,在mysql.user表中,应该有两条记录是:
host user password
127.0.0.1 root
localhost root
对于这两个用户的权限是不同的,你对lcoalhost的root没有赋予访问其他数据库表的权限。赋予权限的语句:
grant all on *.* to root@% identified by 'password'