远程连接mysql
登录centos
启动mysql:sudo systemctl start mysqld
登录mysql:mysql -u root -p
授权远程登录:update user set host = ’%’ where user = ’root’;
修改权限:
grant all on *.* to 'root'@'%' identified by '111111' with grant option;
flush privileges;
重启mysql:sudo systemctl restart mysqld
获取主机地址:hostname -i
防火墙开放mysql使用的3306端口(重要!!!)
firewall-cmd --zone=public --add-port=3306/tcp --permanent
systemctl restart firewalld.service
firewall-cmd --list-ports