进入mysql的配置目录:
/etc/mysql/mysql.conf.d
查看配置文件:
vi mysqld.cnf
查看bind-address和bind-address,如下:
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1
修改为:
bind-address = 0.0.0.0
mysqlx-bind-address = 0.0.0.0
重启mysql
systemctl restart mysql