Ubuntu下MySQL不能远程登录的解决

Q: 当在另一台机器上登录MysqL时出现如下错误

ERROR 2003 (HY000): Can't connect to MysqL server on 'x.x.x.x' (111)

A: 原因是MysqL考虑到安全因素,认配置只让从本地登录

打开 /etc/MysqL/my.cnf 文件,找到 bind-address = 127.0.0.1 修改bind-address = 0.0.0.0

重启MysqL : sudo /etc/init.d/MysqL restart

可参考:

> I've already check my /etc/my.cnf file for a "binding"
> line.  Its not
> there.  I also found an item online that indicated
> adding:
>

Look for the option "skip-networking". This disables TCP/IP so the
server only accepts local connections via the Unix socket. This sounds1
like your situation.
Note that a "Could not connect" error means just that. If the problem
was related to user privileges you would get an "access denied" error.

Q: 还一种情况出现类似下面的错误

ERROR 1045 (28000): Access denied for user 'test'@'x.x.x.x' (using password: NO)

A: 原因是没有给登录用户名设置远程主机登录的权限。

在本地用 root 登录: MysqL -u root -p

修改 MysqL 数据库user 表中 对应用户名Host 字段,将 localhost 改为 %

use MysqL;
update user set Host = '%' where User = 'username';

相关文章

目录前言一、创建Hadoop用户二、更新apt和安装Vim编辑器三、...
原文连接:https://www.cnblogs.com/yasmi/p/5192694.html ...
电脑重启后,打开VirtualBox,发现一直用的虚拟机莫名的消失...
参见:https://blog.csdn.net/weixin_38883338/article/deta...
Ubuntu 18.04 LTS 已切换到 Netplan 来配置网络接口。Netpla...
介绍每个 Web 服务都可以通过特定的 URL 在 Internet 上访问...