环境
- 使用的版本Mysql5.7
-
Mysql 5.7修改密码
mysql> update mysql.user set authentication_string=password('新密码') where user='用户';
mysql> flush privileges;
用户管理
- 查看用户的授权列表
mysql> select * from information_schema.user_privileges;
- 创建用户
CREATE USER 'username'@'host' IDENTIFIED BY 'password';
ex:
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'Admin66668888';
CREATE USER 'admin'@'%' IDENTIFIED BY '';
- 授权
GRANT ALL PRIVILEGES ON *.* TO admin@localhost IDENTIFIED BY 'admin';
-
1.问题:Host '222.35.5.75' is not allowed to connect to this MySQL server
排查IP以及端口是否正确
查看防火墙以及允许访问的端口的安全组是否打开
mysql是否允许远端访问
mysql -uroot -p
输入密码如果能进去,执行以下
mysql> use mysql
mysql> select t.host from user t where t.user='root';
+--------------+
| host |
+--------------+
| localhost |
+--------------+
出现以上表示只能本地访问mysql
执行以下命令,重启mysql即可。
update user set host='%' where user='root';
-
外链