今天在阿里云上重新安装mysql 8。出现两个问题:
1、修改root远程连接:
mysql8不能使用:“grant all privileges on . to ‘user’@’%’;”命令授权远程连接操作,提示“You are not allowed to create a user with GRANT”错误。可使用以下方法:
CREATE USER 'root'@'%' IDENTIFIED BY '密码';
grant all privileges on *.* to 'root'@'%';
之后查mysql.user表:
use mysql;
select host,user from user;
可以看到root的host有%一项。
2、已修改了root远程连接,但用workbench怎么都连接不上,出现错误:“Your connection attempt failed for user ‘root’ to the MySQL server at 39.104.167.197:3306:Can’t connect to MySQL server on ‘39.104.167.197’ (60)”
受http://yangjunwei.com/a/3025.html文章的提醒,可能是3306端口未设置开放。到云管理控制台->安全组->配置规则->添加安全组规则,将3306端口添加进去就可以。