刚刚安装的数据库是只允许本地连接的,这时候如果想用 navicat 连接数据库的话就得用 SSH 连接模式
取消SSH连接:
如果需要给mysql开启远程连接的权限
```
mysql> use mysql;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%(%表示任何电脑,也可以指定ip,指定ip不用写%)' IDENTIFIED BY '(密码)' WITH GRANT OPTION;
mysql> flush privileges;
```
恢复SSH连接
如果开启权限之后又想取消权限
```
mysql> use mysql;
mysql> select host,user from user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| % | root |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+---------------+
mysql> delete from user where host='%';
mysql> flush priviledges;
```
OK 解决
---------------------
作者:虚室有余闲
来源:CSDN
原文:https://blog.csdn.net/liuchangjie0112/article/details/84861369
版权声明:本文为博主原创文章,转载请附上博文链接!