Host Is Not Allowed to Connect to This MySQL Server

Mysql 8 版本 8.0.24

[root@VM-0-5-centos ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 128
Server version: 8.0.24 Source distribution

部署在腾讯云服务器,本地电脑操作python想连接远程MySQL,提示异常

‘ip地址’ Is Not Allowed to Connect to This MySQL Server

显然是权限不足

创建新的管理员用户或修改root用户以允许从“vScopeServerIP”进行连接

> CREATE USER 'newusername'@'*' IDENTIFIED BY 'your_password';
> GRANT ALL PRIVILEGES ON *.* TO 'newusername'@'*' WITH GRANT OPTION;
> CREATE USER 'newusername'@'ip' IDENTIFIED BY 'password';
> GRANT ALL PRIVILEGES ON *.* TO 'newusername'@'ip' WITH GRANT OPTION;
> FLUSH PRIVILEGES;