宝塔Linux新建的mysql无法使用Navicat连接的解决办法

如题,刚安装完宝塔Linux环境之后使用Navicat连mysql服务器连不上的处理办法;

1、宝塔的mysql安装位置在/www/server/data中。所以

$cd /www/server/data 

2、登录mysql

mysql -u root -p

3、切换到mysql数据库

use mysql;

4、输入select user,password,host from user;可以看到host中只有localhost主机。我们需要将xxx.xxx.xxx.xxx也添加到这里才对。所有的双引号都是英文的,否则报错;

grant all privileges on *.* to root@"你要登录的ip地址,也可以使用%代表所用ip都乐意登录" identified by '这里写自己想要设置的mysql登录密码';

5、重新加载一下mysql权限。操作完使用Navicat就可以使用root来登录mysql了;

flush privileges; 

原文地址:https://www.cnblogs.com/dayin1/p/13782757.html