本地连接正常,远程连接虚拟机数据库异常处理

版权声明:转载请注明作者和出处 https://blog.csdn.net/QQ1075687690/article/details/82385379

远程虚拟机 :Linux debian 3.2.0-4-amd64

MySQL版本:

mysql  Ver 14.14 Distrib 5.5.60, for debian-linux-gnu (x86_64) using readline 6.2
 

异常1.2003 - Can't connect to MySQL server on 'x.x.x.x' (10038)

修改了一下MySQL的配置文件:

sudo vi /etc/mysql/my.cnf

在bind-address= 127.0.0.1这一行前加#(注释掉这行),保存后重启

sudo service mysql restart

异常2.1045 access denied for user'root'@'x.x.x.x'(using pasword:yes)

首先本地登陆MySQL,然后执行以下语句:

GRANT ALL PRIVILEGES ON *.* TO'root'@'%' IDENTIFIED BY '数据库密码' WITH GRANT OPTION;

FLUSH PRIVILEGES;

猜你喜欢

转载自blog.csdn.net/QQ1075687690/article/details/82385379