由于目标计算机主动拒绝连接(PHP/WAMP),因此无法建立连接



注意:我意识到这可能被视为重复,但我已经查看了其他响应,他们没有为我解决问题。


我最近在Windows7上安装了带有mysql插件的ZendStudio和ZendServer。

我不是一个合格的服务器管理员,但也不是完全不称职;我花了一整天的时间试图建立一个本地开发"服务器"来减少上传/下载时间。

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

我在尝试让mysql与ZendServer一起工作时遇到了困难。

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

#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).

我试过:

  • 将$cfg['Servers'][$i]['host']从'localhost'更改为'127.0.0.1'
  • 添加/删除$cfg['Servers'][$i]['socket']=''
  • 从cookie更改为配置身份验证类型
  • 重新安装服务器和mysql
  • 禁用防火墙
  • 重新启动机器

Zend的方法是"配置phpmyadmin设置屏幕"。。。我不知道做了多少次。

这里的任何人都能伸出援手,或者指引我一个我还没有尝试过的方向吗?

  1. 转到C:\wamp\bin\mysql\mysql[您的版本]\data
  2. 将"ib_logfile0"one_answers"ib_longfile1"复制并保存到其他任何位置
  3. 删除"ib_logfile0"和ib_logfile 1

为我做了这个把戏。希望对你也有用。

它运行良好。但我们将不得不停止apache和mysql,我们需要退出xampp,然后删除文件。成功删除时。现在启动examplep,它将正常工作。。

只需转到控制面板并启动Apache&MySQL服务。

您可能需要:

  • wampbinmysqlmysqlX.X.XXmy.ini中找到以下行:

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

如您所见,端口号是3308(或者可能是3306)。您应该:

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

  • wampbinapacheapache2.X.XXXbinphp.ini更改中全局更改mysqli.default_port = ...3308

直到昨天,我还能够连接到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: .harleylogin_confirm.ibd. Cannot open tablespace testdb/testtable which uses space ID: 6 at filepath: .testdbtesttable.ibd
InnoDB: Error: could not open single-table tablespace file .testdbtesttable.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 .testdbtesttable.ibd

和这条线路CCD_ 17

嗯,对我来说,testdb只是一个测试db因此,我决定删除C:\wamp\bin\mysql\mysql5.6.7\data\testdb中的此文件

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

我在Wampserver上遇到了同样的问题。它对我有效:

您必须更改此文件:"C:\wamp\bin\mysql[mysql_version\my.ini"例如:"C:\wamp\bin\mysql[mysql5.6.2]\my.ini"

并将默认端口3306更改为80。(第20行和第27行,两者都有)

端口=3306到端口=80

我希望这会有所帮助。

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

在我的案例中,我做了以下事情,并为我的工作

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

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

127.0.0.1 localhost

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

我刚刚删除了mysql服务并重新安装了它。它适用于我

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

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

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

谢谢&当做Jaiswar Vipin Kumar R

以下步骤对我有效。

  1. 转到wamp\apps\phpmyadmin
  2. 搜索config.inc.php
  3. 搜索127.0.0.1并替换为"localhost"