的MySQL连接被拒绝
我已经抬头就如何解决这一问题并没有什么工作,到目前为止, 我得到这个错误 无连接可以作出,因为目标机器积极地拒绝它 我使用Linux的每一个教程centos7 mysql版本 mysql版本14.14 Distrib 5.6.32,用于Linux(x86_64)使用EditLine封装 blow is my.cnf 我还必须创建自己的my.cnf,因为当我安装mysql时它没有一个位于我把它放到etc/my.cnf中,它运行的是cnf,因为它将mysql从严格模式中取出。的MySQL连接被拒绝
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
bind-address = 0.0.0.0
#skip-networking
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
好吧,我假设你已经安装了这个完全不同的机器上(而不是在虚拟主机上的Windows中)。
您需要确保首先在您的数据库服务器上打开端口3306。你可以用端口检查器来检查(有很多免费的在线)。
然后,用户尝试连接的用户需要确保该用户可以访问源IP地址(即Windows机器上的IP)。这可以通过mysql提示符下面的代码完成。
GRANT ALL PRIVILEGES ON <your db name>.* TO <your user>@<your ip> IDENTIFIED BY '<your password>';
不太安全的选项是通过使用%通配符来允许所有入站IP。
之后,您需要运行以下命令。
FLUSH PRIVILEGES;
应该是这样。
好吧,它的工作感谢兄弟你是一个生活的节省感谢一切保持活跃,你真棒 –
不客气! – cherrysoft
你能否提供一点细节。您是否试图通过MySQL客户端(或其他软件)或远程访问本地计算机? – cherrysoft
〜我试图通过我的网站使用php连接到mysql,但说警告:mysqli :: mysqli():(HY000/2002):由于目标机器主动拒绝,无法建立连接。在第8行的C:\ xampp \ htdocs \ test.php中 连接失败:由于目标机器主动拒绝连接,因此无法建立连接。 –