虚拟机linux系统无法通过ip访问window本地mysql数据库

异常情况:

可通过localhost及127.0.0.1访问mysql,但当以ip的形式访问时(192.168.1.2),出现拒绝访问。

解决方法:

在mysql安装目录bin下面打开命令行窗口;

1、登录
mysql -u root -p 2、查询mysql用户 select user,host,authentication_string from mysql.user; 3、 切换到mysql库 use mysql; 4、 修改root用户host update user set host='%' where user='root'。
posted on 2021-12-26 21:08  西八没天台  阅读(301)  评论(0编辑  收藏  举报