在终端输入,查看防火墙状态
systemctl status firewalld
关闭防火墙
systemctl stop firewalld
关闭防火墙自启动
systemctl disable firewalld
再查看防火墙状态
systemctl status firewalld1.4 开启mysql远程连接
进入opt文件夹
[root@liujiangtao01 ~]# cd /opt
进入MySQL
[root@liujiangtao01 opt]# mysql -uroot -p
进入库,再查看可连接用户
mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select host,user from user; +-----------+------------------+ | host | user | +-----------+------------------+ | localhost | mysql.infoschema | | localhost | mysql.session | | localhost | mysql.sys | | localhost | root | +-----------+------------------+ 4 rows in set (0.00 sec)
改成可以远程连接的IP
mysql> update user set host = '192.168.118.%' where user = 'root'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
查看是否成功
mysql> select host,user from user; +---------------+------------------+ | host | user | +---------------+------------------+ | 192.168.118.% | root | | localhost | mysql.infoschema | | localhost | mysql.session | | localhost | mysql.sys | +---------------+------------------+ 4 rows in set (0.00 sec)
刷新
mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql>
再更改密码
ALTER USER 'root'@'192.168.118.%' IDENTIFIED WITH mysql_native_password BY '密码';



