不允许远程连接这个数据库,你看下mysql端口是否打开,另外查看一下mysql是否允许远程连接
几个解决方案,自己看下
1.修改改MySQL配置文件(/etc/mysql/my.cnf),注释以下行:
#bind-address = 127.0.0.1
2.重启mysql数据库,对于Ubuntu系统,执行如下命令
sudo /etc/init.d/mysql restart
3.以root用户登录mysql后,执行如下命令:
grant all privileges on *.* to root@’允许登录的远程机器ip’
identified by ‘密码’
或者
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
如果你想允许用户myuser从ip为168.160.12.50的主机连接到mysql服务器,并使用mypassword作为密码
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'168.160.12.50' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;