#2002 - 无法建立连接,因为目标计算机主动拒绝它

时间:2013-07-17 18:54:18

标签: mysql zend-server

我意识到这可能被视为重复,但我查看了其他回复,他们没有为我解决问题。

我最近在Windows 7上安装了带有mysql插件的Zend Studio和Zend Server。

我不是合格的服务器管理员,但我也不是完全无能;我一直在努力争取本地开发服务器'最多可以减少上传/下载时间。

当我说服务器/机器时,我的意思是我的家用电脑

我试图让mysql与Zend Server一起工作。

我一直收到的错误是(或详细):

#2002 Cannot log in to the MySQL server
or (if i change to 'config' authentication type)
#2002 - No connection could be made because the target machine actively refused it.

The server is not responding (or the local server's socket is not correctly configured).

我试过了:

  • 从' localhost'更改$ cfg ['服务器'] [$ i] [' host']到' 127.0.0.1'
  • 添加/删除$ cfg ['服务器'] [$ i] [' socket'] ='';
  • 从cookie更改为config auth type
  • 重新安装服务器和mysql
  • 禁用防火墙
  • 重启机器

Zend的方法是配置phpmyadmin设置屏幕' ...完成我不知道多少次。

这里的任何人都可以伸出援助之手,或者指出我尚未尝试过的方向吗?

11 个答案:

答案 0 :(得分:37)

  1. 转到C:\ wamp \ bin \ mysql \ mysql [your-version] \ data
  2. 在其他地方复制并保存“ib_logfile0”和“ib_logfile1”。
  3. 删除“ib_logfile0”和ib_logfile1
  4. 我的诀窍。希望它也适合你。

    工作正常。 但是我们必须停止apache和mysql,我们需要退出xampp然后删除文件。删除成功后。现在启动xampp它将正常工作..

答案 1 :(得分:9)

只需转到“控制”面板,然后启动Apache& MySQL服务。

答案 2 :(得分:3)

直到昨天我才能连接到 phpMyAdmin ,但今天我开始收到此错误:

<强> 2002-no-connection-could-be-made-because-the-target-machine-actively-refused

这里的答案都没有真正帮助我解决问题,有什么帮助我在下面分享:

我查看了mysql日志。[C:\ wamp \ logs \ mysql.log]

它说

2015-09-18 01:16:30 5920 [Note] Plugin 'FEDERATED' is disabled.
2015-09-18 01:16:30 5920 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-09-18 01:16:30 5920 [Note] InnoDB: The InnoDB memory heap is disabled
2015-09-18 01:16:30 5920 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-09-18 01:16:30 5920 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-09-18 01:16:30 5920 [Note] InnoDB: Not using CPU crc32 instructions
2015-09-18 01:16:30 5920 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-09-18 01:16:30 5920 [Note] InnoDB: Completed initialization of buffer pool
2015-09-18 01:16:30 5920 [Note] InnoDB: Highest supported file format is Barracuda.
2015-09-18 01:16:30 5920 [Note] InnoDB: The log sequence numbers 1765410 and 1765410 in ibdata files do not match the log sequence number 2058233 in the ib_logfiles!
2015-09-18 01:16:30 5920 [Note] InnoDB: Database was not shutdown normally!
2015-09-18 01:16:30 5920 [Note] InnoDB: Starting crash recovery.
2015-09-18 01:16:30 5920 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-09-18 01:16:30 5920 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace harley/login_confirm uses space ID: 6 at filepath: .\harley\login_confirm.ibd. Cannot open tablespace testdb/testtable which uses space ID: 6 at filepath: .\testdb\testtable.ibd
InnoDB: Error: could not open single-table tablespace file .\testdb\testtable.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.

我得知这个人正在制造问题的线索 - InnoDB: Error: could not open single-table tablespace file .\testdb\testtable.ibd

此行2015-09-18 01:16:30 5920 [Note] InnoDB: Database was not shutdown normally!

嗯,对我来说testdb只是一个测试db! 因此我决定在C:\ wamp \ bin \ mysql \ mysql5.6.17 \ data \ testdb

中删除此文件

重新启动所有服务,然后转到phpMyAdmin,这次没有问题,phpMyAdmin打开了:)

答案 3 :(得分:2)

我和Wampserver有同样的问题。它对我有用:

您必须更改此文件:&#34; C:\ wamp \ bin \ mysql [mysql_version] \ my.ini&#34; 例如:&#34; C:\ wamp \ bin \ mysql [mysql5.6.12] \ my.ini&#34;

并将默认端口3306更改为80.(第20行和第27行)

port = 3306 至 port = 80

我希望这有用。

答案 4 :(得分:2)

为了摆脱这个错误,我所要做的就是重新启动我的wamp服务器。

答案 5 :(得分:1)

请检查etc文件夹中的hosts文件并添加以下注释,然后运行wamp server。

127.0.0.1 localhost

路径: C:\ Windows \ System32 \ drivers \ etc

答案 6 :(得分:1)

我刚刚删除了mysql服务并再次安装它。它对我有用

答案 7 :(得分:1)

就我而言,我做了以下工作并为我工作

  1. 我点击了沼泽图标。
  2. 我去了MySQL>服务管理'wampmysqld64'>安装服务
  3. 然后单击wamp图标>重新启动所有服务。

答案 8 :(得分:1)

您可能需要:

  • wamp\bin\mysql\mysqlX.X.XX\my.ini中找到以下行:

    [client] ... port = 3308 ... [wampmysqld64] ... port = 3308

如您所见,端口号为 3308 。您应该:

  • 在WordPress等应用程序中使用该端口:define('DB_HOST', 'localhost:3308')

  • wamp\bin\apache\apache2.X.XXX\bin\php.ini更改中全局更改 mysqli.default_port = ...3308

答案 9 :(得分:0)

请检查您的mysql服务是否正在运行。

对于Windows用户:检查服务-mysql服务

对于Linux用户::检查mysql服务/守护程序是否正在运行(服务mysql状态)

感谢与问候 Jaiswar Vipin Kumar R

答案 10 :(得分:-1)

以下步骤为我工作。

  1. 转到wamp \ apps \ phpmyadmin
  2. 搜索config.inc.php
  3. 搜索127.0.0.1并替换为&#34; localhost&#34;。
相关问题