我正在尝试允许外部访问MySQL服务器。首先,我将my.cnf更改为this(my.cnf的一部分): [mysqld_safe的] socket = /var/run/mysqld/mysqld.sock nice = 0
ImageView
在/etc/hosts.allow中我添加了: mysqld:全部
另外我添加了用户'root'@'%',但我拥有的是: 我正在尝试使用外部主机名从服务器连接到服务器:
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
但是使用'localhost'一切都很好: root @ ******:〜#mysql -hlocalhost -u root -p
MySQL服务器版本:5.5.43 Ubuntu 14.10(GNU / Linux 3.16.0-23-通用x86_64)
答案 0 :(得分:1)
您应该在创建用户后运行命令 -
GRANT ALL ON dbname.* TO 'root'@'%' IDENTIFIED BY 'root';
FLUSH HOSTS;
FLUSH PRIVILEGES;
如果您已经运行此代码,则可能存在防火墙问题 -