1:添加阿里云安全组规则的MySQL 3306端口
点击左侧导航栏安全组
点击配置规则
点击添加安全组规则
设置协议类型为MySQL3306 ,授权对象为所有ip
2.添加所有IP都可以访问的用户:
grant all on *.* to '用户名'@'%' identified by '密码';
或者也可以给root用户设置为所有ip都可访问:
update user set host='%' where user='root' and host='localhost';
刷新权限:flush privileges;
3.修改密码
use mysql;
5.7版本以上数据库可用
update mysql.user set authentication_string=password('*******') where user='*******'; #修改密码成功
flush privileges; #立即生效
重启mysql服务