mysql不支持远程连接的解决办法(#报错:1130-host ... is not allowed to connect to this MySql server 开放mysql远程连接 不使用lo

来源:互联网 发布:linux命令行登录mysql 编辑:程序博客网 时间:2024/05/17 00:18

对初次使用mysql的人来说经常出现如下错误“#1130 - Host 'localhost' is not allowed to connect to this MySQL server”或只能过过localhost连接mysql不能通过ip地址连接到mysql,这都是mysql远程登陆的问题。

mysql默认是不支持远程登陆的,所以要实现远程登陆必须用户进行设置

1、通过提升root用户的权限来支持远程登陆

2、通过创建一个用户并设置相应的权限来支持远程登陆

方法1通过改变root用户的权限来达到目的并不是最好的办法,最好通过新建一个用户并设置权限最好,所以我们采用方法2

步骤:

1、  启动mysql客户端,并输入用户密码

        

2、  建立一个用户’admin’,密码为’123’,输入如下命令:

grant all on *.* to ‘admin’@’%’ identified by ‘123’ with grant option

 

3、  通过查看用户表,是否增加了admin用户,输入如下命令:

use mysql;

select host,user from user;

 

备注:grant命令的详细情况参见mysql手册,以上操作对解决mysql远程登陆已经足够。

0 0
原创粉丝点击