无法从远程服务器连接到 MySQL

无法从远程服务器连接到 MySQL

我无法从 Azure 访问 Ubuntu 16.04.02 VPS 上的 MySQL 服务器。我尝试编辑 /etc/mysql/my.cnf,但没有任何效果 - 没有类似 bind 127.0.0.1 的内容。我使用通配符创建了用户,但仍然收到拒绝连接的消息。我该怎么办?

我的cnf

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

终端输出:

azure@pinf-vps:~$ sudo lsof -Pni :3306
COMMAND   PID  USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
mysqld  29117 mysql   15u  IPv4 2516519      0t0  TCP 127.0.0.1:3306 (LISTEN)

我还仔细检查了 VPS 和防火墙上的端口是否打开。

谢谢你的帮助。

答案1

在 Ubutu 16.04 中,您要查找的配置文件的位置是/etc/mysql/mysql.conf.d/mysqld.cnf

相关内容