1 MySql-Server 出于安全方面考虑默认只允许本机(localhost, 127.0.0.1)来连接访问
2 修改root的密码符合mysql的默认规则
- alter mysql 操作mysql系统表
- ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘W20289@qq.com’;
3 update user set host = ‘%’ where user =‘root’;
查看更新 :select user,host from user,出现以下情况则可以远程访问
------------------+-----------+
| user | host |
+------------------+-----------+
| root | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| wzh | localhost |
+------------------+-----------+
4 flush privileges; //刷新
5 注意:如果是远程连接阿里云服务器的mysql,那么需要以下配置