由于出现“拒绝连接",我无法使用MySQL. [英] I am unable to use MySQL due to a "refused connection"

查看:89
本文介绍了由于出现“拒绝连接",我无法使用MySQL.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在计算机上 C:/mysql/的Windows XP上运行MySQL的免安装版本.

I am trying to run the no-install version of MySQL on Windows XP located in C:/mysql/ on my machine.

当我尝试连接到MySQL时,我在PHP文件中收到错误消息.

The error message I receive within a PHP file when I try to connect to MySQL reads.

无法连接:由于目标计算机主动拒绝连接,因此无法建立连接

Could not connect: No connection could be made because the target machine actively refused it

我已经编辑了配置文件 my.ini ,并更改/添加了以下内容.

I have edited the config file my.ini and altered/added the following.

[client]
port        = 3306
socket      = C:/mysql/tmp/mysql.sock

[mysqld]
port        = 3306
socket      = C:/mysql/tmp/mysql.sock
basedir = C:/mysql/
datadir = C:/mysql/data/
bind-address = 127.0.0.1
skip-networking
enable-named-pipe

当我运行mysqld.exe时,我可以确认它正在命令提示符任务列表中运行. 但是,当我尝试使用cmd netstat -a 时,在3306上看不到任何端口使用情况.

When I run mysqld.exe I can confirm it is running within command prompt tasklist. However when I try cmd netstat -a I cannot see any port usage at 3306.

在MySQL错误日志中,它读取.

Inside MySQL error logs, it reads.

140411 13:30:34 [注意] c:\ mysql \ bin \ mysqld.exe:准备连接. 版本:'5.5.37-log'套接字:''端口:0 MySQL Community Server(GPL)

140411 13:30:34 [Note] c:\mysql\bin\mysqld.exe: ready for connections. Version: '5.5.37-log' socket: '' port: 0 MySQL Community Server (GPL)

端口:0在我看来不正确,但我不确定.

The port: 0 doesn't look correct to me, but I am not sure.

当我直接在cmd中运行mysql.exe时,我得到了以下返回信息

When I run mysql.exe direct in cmd I get the following returned

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

我已经尝试过一些东西.

Some things I have tried already.

  • 在C:/WINDOWS中放置 my.ini 的副本,并在C:/mysql中放置一个副本
  • bind-address = 127.0.0.1 更改为 bind-address = 本地主机
  • 在基本mysql_connect()内部的
  • 内部PHP文件MySQL连接变体 localhost 127.0.0.1 127.0.0.1:3306 >
  • 创建了tmp/mysql.sock文件(如果dir +文件不存在的话)
  • my.ini
  • 中注释了 skip-networking
  • 在运行mysqld.exe的同时在cmd中运行mysqladmin.exe并返回无法在'localhost'连接到MySQL服务器"
  • 运行telnet localhost 3306返回 '正在连接到本地主机...无法打开端口3306上的主机连接:C onnect失败'
  • 注释了 my.ini 中的绑定地址以允许默认设置.
  • 具有用户根( -u root )的mysqld.exe也在 my.ini
  • 中插入了 user = root
  • 将Windows防火墙设置为关闭.
  • Placing a copy of my.ini in C:/WINDOWS and also a copy within C:/mysql
  • Changing bind-address = 127.0.0.1 to bind-address = localhost
  • Inside PHP file MySQL connection variants, localhost, 127.0.0.1, 127.0.0.1:3306 inside basic mysql_connect()
  • Created tmp/mysql.sock file (in case dir + file not existing matters)
  • Commented out skip-networking in my.ini
  • After running mysqld.exe whilst running ran mysqladmin.exe in cmd which returns 'Can't connect to MySQL server at 'localhost'
  • Running telnet localhost 3306 returns 'Connecting To localhost...Could not open connection to the host, on port 3306: C onnect failed'
  • Commented out bind-address in my.ini to allow default settings.
  • Ran mysqld.exe with user root (-u root) also inserted user = root in my.ini
  • Set Windows Firewall to off.

谢谢.

推荐答案

好.您已将服务器绑定到特定的IP,因此请阅读此 MySQL绑定地址.请解除您的服务器的绑定,并检查您是否具有正确的用户. (文档的最后一段)

Ok. You have binded your server to specific ip so please read this MySQL bind-addres. Please unbind your server and check if you have proper user. (last paragraph in documentation)

这篇关于由于出现“拒绝连接",我无法使用MySQL.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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