navicat 连接不了mysql

登录数据库查看用户权限,如果如下,没有开放对外权限,连接不上,需要配置权限

mysql> select user,host from mysql.user;
+---------------+-----------+
| user          | host      |
+---------------+-----------+
| mysql.session | localhost |
| mysql.sys     | localhost |
| root          | localhost |
+---------------+-----------+
3 rows in set (0.00 sec)
#GRANT ALL PRIVILEGES ON *.* TO 'root'@'主机' IDENTIFIED BY '密码' WITH GRANT OPTION;
# %:代表所有主机
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;           #刷新权限
posted @ 2023-10-24 11:14  买定灬离手  阅读(29)  评论(0编辑  收藏  举报