1.先是修改了配置文件,注释掉bind
/etc/mysql/mysql.conf.d/mysqld.cnf
2.接着增加了root %
mysql -u root -p
use mysql;
select User,authentication_string,Host from user;
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘密码‘;
flush privileges;
确认:select User,authentication_string,Host from user;
service mysql restart
3.最后打开了防火墙。
查看开放端口:
sudo ufw status
允许80端口开放:
sudo ufw allow 3306