MySQL连接被拒绝 [英] MySQL Connection Refused

查看:88
本文介绍了MySQL连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看了有关如何解决此问题的所有教程,但到目前为止没有任何效果,我收到这个错误无法建立连接,因为目标机器主动拒绝了它我正在使用linux centos7 mysql版本适用于Linux(x86_64)的mysql Ver 14.14 Distrib 5.6.32,使用EditLine包装器打击是my.cnf我还必须创建自己的my.cnf,因为当我安装mysql时没有找到我将其放入etc/my.cnf的程序,它正在运行cnf,因为它使mysql退出了严格模式.

i've looked up every tutorial on how to fix this and nothing worked so far, I'm getting this error No connection could be made because the target machine actively refused it i'm using linux centos7 mysql version mysql Ver 14.14 Distrib 5.6.32, for Linux (x86_64) using EditLine wrapper blow is my.cnf also i had to create my own my.cnf as when i installed mysql it didn't have one located i put this into etc/my.cnf it's running the cnf as it's taken mysql out of strict mode.

# 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框中的虚拟主机).

Ok, I am assuming that you have installed this on a completely different machine (as opposed to a Virtual Host on your Windows box).

您需要确保首先在数据库服务器上打开端口3306.您可以使用端口检查器进行检查(在线有很多免费的检查器).

You need to make sure that port 3306 is open on your DB server first and foremost. You can check this with a port checker (there are plenty of free ones online).

然后,与您尝试连接的用户一起,需要确保该用户可以通过原始IP地址(即Windows计算机上的IP)进行访问.可以使用mysql提示符中的以下代码来完成此操作.

Then, with the user you are trying to connect with, you need to make sure that user has access from the origin IP address (i.e. the IP on your Windows machine). This can be done with the following code from the mysql prompt.

GRANT ALL PRIVILEGES ON <your db name>.* TO <your user>@<your ip> IDENTIFIED BY '<your password>';

一个不太安全的选择是使用%通配符允许所有入站IP.

A less secure option would be to allow all inbound IPs by using the % wildcard.

此后,您需要运行以下命令.

After this you need to run the following command.

FLUSH PRIVILEGES;

应该的.

这篇关于MySQL连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆