连接局域网内的Mysql8服务器

假设同一局域网内A主机想要连接B主机的mysql服务器
首先需要在B主机的MySQL运行一下sql(根据自己的ip,账号密码更改)
格式:

 create user '用户名'@'A主机ip' identified by '登陆密码';
 
 grant all PRIVILEGES on 数据库名.表名(也可以使用 *.*) to '用户名'@'A主机ip' with grant option;

例如

 create user 'root'@'192.168.1.6' identified by '123456';
 
 grant all PRIVILEGES on *.* to 'root'@'192.168.1.6' with grant option;

最后,再A主机用root 和 123456 连接B主机mysql服务器即可连接成功!

你可能感兴趣的:(Linux,服务器,mysql,数据库,运维)