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

查看:60
本文介绍了由于“拒绝连接",我无法使用 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 社区服务器 (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 =本地主机
  • 在 PHP 文件中 MySQL 连接变体,localhost127.0.0.1127.0.0.1:3306 在基本 mysql_connect() 中
  • 创建 tmp/mysql.sock 文件(以防 dir + 文件不存在)
  • 注释掉 my.ini 中的 skip-networking
  • 在运行 mysqld.exe 的同时在 cmd 中运行 mysqladmin.exe 后,返回无法连接到位于 'localhost' 的 MySQL 服务器
  • 运行 telnet localhost 3306 返回'正在连接到本地主机...无法在端口 3306 上打开到主机的连接:C连接失败'
  • 注释掉 my.ini 中的 bind-address 以允许默认设置.
  • 使用 root 用户 (-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天全站免登陆