mysql只能本地登录而无法远程IP访问,求助
牧牛童子 2017-07-28 07:59:54 mysql -u root -p 能登录成功;
mysql -h 192.168.11.10 -u root -p 则提示:Can't connect to MySQL server on '192.168.11.10' (111)
telnet localhost 3306,端口通;
telnet 192.168.11.10 3306,没反应,不通。说明mysql并没监听这个ip地址;
于是/etc/mysql/my.cnf。里面没有 bind-address= ???这行。我加上之后发现mysql无法起动。
尝试过以下方法,都不凑效 :
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
也新添加过一个帐号。
----------------------------------------------------------
/etc/mysql/my.cnf文件内容:
user001@UKylin:/$ cat /etc/mysql/my.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.
#
#bind_address = 0.0.0.0 //是我添加的。不能启动mysql
#bind-address = 0.0.0.0 //是我添加的。不能启动mysql
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
user001@UKylin:/$
----------------------------------------------------------