好记性真不如烂笔头
修改mysql配置文件
本人 mysql5.7配置文件 /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 0.0.0.0 # 所有地址都可以访问
mysq用户
root权限进入 mysql
GRANT ALL PRIVILEGES ON <数据库>.* TO '<用户>'@'<远程ip>' IDENTIFIED BY '<密码>' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON db_dev.* TO 'zqw'@'1.1.1.1' IDENTIFIED BY '12345' WITH GRANT OPTION;
FLUSH PRIVILEGES;
select Host, User, authentication_string from mysql.user ;
重启mysql
sudo service mysql restart
防火墙
测试
mysql -uremote -h 1.1.1.1. -p