远程连接mysql数据库配置


1. 配置连接端mysql设置

vim /etc/mysql/mysql.conf.d/mysql.cnf


#更改mysql.conf文件第43行绑定地址为mysql主机的外网地址.

43  bind-address        = 192.168.0.1

 


2. 主机授权.


主机进入mysql. 输入授权命令

grant all privileges on 授权的数据库.数据库中的具体表 to '连接端用户'@'连接端IP地址' identified by '连接端输入的密码' with grant option;


例如:(授予IP-外网地址-为192.168.0.2下的root用户使用密码mypassword登录时,对mydatabase数据库下所有表格操作的权限.)

grant all privileges on mydatabase.* to 'root'@'192.168.0.2' identified by 'mypassword' with grant option; 


激活授权

flush privileges;

 

完成.

posted @ 2019-09-11 19:25  Jrri  阅读(2151)  评论(0编辑  收藏  举报