DBEaver不显示mysql系统表无法将host改为%处理方法

138 阅读1分钟

DBEaver不显示mysql系统表无法将host改为%处理方法

这里提供命令行方式

1.登陆mysql

mysql -u root -p

如果mysql不是系统命令可以cd到mysql目录执行

2.查询表是否存在

SELECT table_name 
FROM information_schema.tables 
WHERE table_schema = 'mysql' 
AND table_name = 'user';

3.查看表数据

SELECT Host, User, grant_priv, plugin FROM mysql.user;

4.将用户host参数设为%

UPDATE mysql.user
SET Host = '%'
WHERE User = '替换用户名';

5.现在就可以用ip+端口登陆了

有时会出现表没有给权限到用户,可以按以下解决方式

GRANT ALL PRIVILEGES ON 表名.* TO '用户名'@'%';

执行后刷新权限

FLUSH PRIVILEGES;

如果出现you are not allowed to create user with grant说明当前为localhost登陆将root的host属性改为%重新执行即可.