目录
- 解疑:此处错误,说明mysql服务起未授权,登录,用户名正确,所以需要在mysql服务器上,给远程登录用户添加访问权限。
- 解决方法1:登录mysql服务器,添加权限,输入如下命令:
-
grant all on *.* to 用户名@"服务器名" identified by "密码"; flush priviledes;
- 授权法 将host字段值改为% ,就表示在任何客户端机机器上,都能以root用户登录到mysql服务器上,命令如下:
update user set host = '%' where user = 'root';
// 将权限改为all privileges
use mysql;
// database changed
grant all privileges on *.* to root@'%' identified by 'root';
select host,user,password from user; //查询host user,密码