首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Wampserver图标没有完全变绿,mysql服务没有启动?

Wampserver图标没有完全变绿,mysql服务没有启动?
EN

Stack Overflow用户
提问于 2013-07-20 19:47:23
回答 25查看 111.7K关注 0票数 13

我在localhost上运行了一个应用程序,它已经成功运行了至少一年,但突然之间wampserver无法启动。每当我右击任务栏图标并“启动所有服务”时,它就会变成橙色,但永远不会变成绿色。昨天出现了一个数据丢失问题,因为其中一个mysql表崩溃了,必须修复,如果这与此有任何关系的话。

如果我尝试http://localhost/phpmyadmin,我会得到一个403 Forbidden错误,这是我以前从未得到过的。

我今天检查了apache日志,它的最新条目是:

代码语言:javascript
运行
复制
[Sat Jul 20 14:17:31 2013] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:31 2013] [error] [client 127.0.0.1] PHP   1. {main}() D:\\wamp\\www\\zeejflow\\index_exe.php:0, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:31 2013] [error] [client 127.0.0.1] PHP   2. mysql_real_escape_string() D:\\wamp\\www\\zeejflow\\index_exe.php:25, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:31 2013] [error] [client 127.0.0.1] PHP Warning:  mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: A link to the server could not be established in D:\\wamp\\www\\zeejflow\\index_exe.php on line 25, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:31 2013] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:31 2013] [error] [client 127.0.0.1] PHP   1. {main}() D:\\wamp\\www\\zeejflow\\index_exe.php:0, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:31 2013] [error] [client 127.0.0.1] PHP   2. mysql_real_escape_string() D:\\wamp\\www\\zeejflow\\index_exe.php:25, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:32 2013] [error] [client 127.0.0.1] PHP Warning:  mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: [2002] No connection could be made because the target machine actively  (trying to connect via tcp://localhost:3306) in D:\\wamp\\www\\zeejflow\\index_exe.php on line 26, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:32 2013] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:32 2013] [error] [client 127.0.0.1] PHP   1. {main}() D:\\wamp\\www\\zeejflow\\index_exe.php:0, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:32 2013] [error] [client 127.0.0.1] PHP   2. mysql_real_escape_string() D:\\wamp\\www\\zeejflow\\index_exe.php:26, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:32 2013] [error] [client 127.0.0.1] PHP Warning:  mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: No connection could be made because the target machine actively refused it.\r\n in D:\\wamp\\www\\zeejflow\\index_exe.php on line 26, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:32 2013] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:32 2013] [error] [client 127.0.0.1] PHP   1. {main}() D:\\wamp\\www\\zeejflow\\index_exe.php:0, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:32 2013] [error] [client 127.0.0.1] PHP   2. mysql_real_escape_string() D:\\wamp\\www\\zeejflow\\index_exe.php:26, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:32 2013] [error] [client 127.0.0.1] PHP Warning:  mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: A link to the server could not be established in D:\\wamp\\www\\zeejflow\\index_exe.php on line 26, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:32 2013] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:32 2013] [error] [client 127.0.0.1] PHP   1. {main}() D:\\wamp\\www\\zeejflow\\index_exe.php:0, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:32 2013] [error] [client 127.0.0.1] PHP   2. mysql_real_escape_string() D:\\wamp\\www\\zeejflow\\index_exe.php:26, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:33 2013] [error] [client 127.0.0.1] PHP Warning:  mysql_num_rows() expects parameter 1 to be resource, integer given in D:\\wamp\\www\\zeejflow\\index_exe.php on line 34, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:33 2013] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:33 2013] [error] [client 127.0.0.1] PHP   1. {main}() D:\\wamp\\www\\zeejflow\\index_exe.php:0, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:33 2013] [error] [client 127.0.0.1] PHP   2. mysql_num_rows() D:\\wamp\\www\\zeejflow\\index_exe.php:34, referer: http://localhost/zeejflow/index.php
[Sat Jul 20 14:17:33 2013] [error] an unknown filter was not added: DEFLATE
[Sat Jul 20 14:17:33 2013] [error] an unknown filter was not added: DEFLATE
[Sat Jul 20 14:17:33 2013] [error] an unknown filter was not added: DEFLATE

index_exe.php上的第25行和第26行很简单,如下所示(我正在尝试登录应用程序):

代码语言:javascript
运行
复制
$userName = mysql_real_escape_string($_POST['userName']);
$Password = mysql_real_escape_string($_POST['Password']);

由于[2002] No connection could be made because the target machine actively (trying to connect via tcp://localhost:3306错误,我认为使用相同端口的其他应用程序可能会出现问题,所以我尝试了以下方法(我的wamp在D:上运行):

代码语言:javascript
运行
复制
C:\Users\admin>netstat

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    127.0.0.1:5939         localhost127:49313     ESTABLISHED
  TCP    127.0.0.1:5939         localhost127:49317     ESTABLISHED
  TCP    127.0.0.1:49155        localhost127:49156     ESTABLISHED
  TCP    127.0.0.1:49156        localhost127:49155     ESTABLISHED
  TCP    127.0.0.1:49157        localhost127:49158     ESTABLISHED
  TCP    127.0.0.1:49158        localhost127:49157     ESTABLISHED
  TCP    127.0.0.1:49311        localhost127:49312     ESTABLISHED
  TCP    127.0.0.1:49312        localhost127:49311     ESTABLISHED
  TCP    127.0.0.1:49313        localhost127:5939      ESTABLISHED
  TCP    127.0.0.1:49315        localhost127:49316     ESTABLISHED
  TCP    127.0.0.1:49316        localhost127:49315     ESTABLISHED
  TCP    127.0.0.1:49317        localhost127:5939      ESTABLISHED
  TCP    127.0.0.1:49320        localhost127:49321     ESTABLISHED
  TCP    127.0.0.1:49321        localhost127:49320     ESTABLISHED
  TCP    192.168.15.200:49166   server6201:5938        ESTABLISHED
  TCP    192.168.15.200:49847   Server-PC:netbios-ssn  TIME_WAIT
  TCP    192.168.15.200:49848   Server-PC:netbios-ssn  TIME_WAIT

D:\>netstat

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    127.0.0.1:80           localhost127:49799     TIME_WAIT
  TCP    127.0.0.1:80           localhost127:49800     TIME_WAIT
  TCP    127.0.0.1:80           localhost127:49801     TIME_WAIT
  TCP    127.0.0.1:80           localhost127:49802     TIME_WAIT
  TCP    127.0.0.1:80           localhost127:49803     TIME_WAIT
  TCP    127.0.0.1:80           localhost127:49804     TIME_WAIT
  TCP    127.0.0.1:80           localhost127:49806     TIME_WAIT
  TCP    127.0.0.1:80           localhost127:49810     TIME_WAIT
  TCP    127.0.0.1:80           localhost127:49811     TIME_WAIT
  TCP    127.0.0.1:5939         localhost127:49313     ESTABLISHED
  TCP    127.0.0.1:5939         localhost127:49317     ESTABLISHED
  TCP    127.0.0.1:49155        localhost127:49156     ESTABLISHED
  TCP    127.0.0.1:49156        localhost127:49155     ESTABLISHED
  TCP    127.0.0.1:49157        localhost127:49158     ESTABLISHED
  TCP    127.0.0.1:49158        localhost127:49157     ESTABLISHED
  TCP    127.0.0.1:49311        localhost127:49312     ESTABLISHED
  TCP    127.0.0.1:49312        localhost127:49311     ESTABLISHED
  TCP    127.0.0.1:49313        localhost127:5939      ESTABLISHED
  TCP    127.0.0.1:49315        localhost127:49316     ESTABLISHED
  TCP    127.0.0.1:49316        localhost127:49315     ESTABLISHED
  TCP    127.0.0.1:49317        localhost127:5939      ESTABLISHED
  TCP    127.0.0.1:49320        localhost127:49321     ESTABLISHED
  TCP    127.0.0.1:49321        localhost127:49320     ESTABLISHED
  TCP    192.168.15.200:49166   server6201:5938        ESTABLISHED
  TCP    192.168.15.200:49805   mrs02s05-in-f4:http    ESTABLISHED

但现在我不知道该怎么做了。我确保my.ini已经指定了端口3306,并且它已经指定了(不管怎么说,一年内没有人更改它,它怎么会突然有另一个值)。有什么需要帮忙的吗?我认为Apache是工作的,因为当我输入http://localhost时,它工作了,并提供了转到phpmyadmin或我的应用程序文件夹的选项,但它似乎mysql服务没有启动或什么?我与管理员确认,没有安装新的软件(如Skype)或任何东西。

更新

我去Services.msc查看了wampapache,状态是“已启动”。但是wampmysqld没有身份。所以我右击并选择了"Start“。一条消息说"Windows正在尝试在本地计算机上启动该服务“,但随后我收到了以下错误:

代码语言:javascript
运行
复制
Windows could not start the wampmysqld service on Local Computer
Error 1067: The process terminated unexpectedly

到底是怎么回事?

更新2

我让mysql再次工作了,如下所示:

mysqld working but wampmysqld not starting up

HowEVER,localhost://phpmyadmin仍然给我一个403 forbidden错误,而mysql_connect一直给我一个“拒绝访问”的错误。

EN

回答 25

Stack Overflow用户

发布于 2015-12-22 19:08:32

转到:wamp\bin\mysql\mysql5.6.17\data并删除以下内容:

auto.cnfxxxxxxxxx.errxxxxxxxxx.pidib_logfile0ib_logfile1

让其他文件保持原样。

如果是skype占用了您的端口80,则转到skype: tools>option并在advance>connection中取消选中“使用端口80和443……”

票数 14
EN

Stack Overflow用户

发布于 2013-10-04 15:15:50

这件事今天发生在我身上。由于我从昨天起就没有更改过我的系统设置,所以我认为这主要是系统上的mysql问题。我设法用下面的方法修复了它。

  1. 打开wampserver的mysql日志文件。这将包含有关服务抛出错误和退出prematurely.
  2. In的原因的信息。我的情况是,mysql服务无法启动,因为它无法读取某个表空间。日志中指明了特定表空间。
  3. 无法读取此类文件可能是因为文件权限或文件已损坏。在这种情况下,mysql将停止执行,以避免损坏可能链接到所需数据库的表空间文件。通常,如果您有数据库的备份,则可以安全地删除此有问题的文件,并在mysql服务重新启动后恢复数据库。
  4. 如果您没有数据库备份,则可以通过启用my.cnf / my.ini文件中的选项来强制mysql实例运行恢复。

innodb_force_recovery =1

这会强制实例运行崩溃恢复。

注意:安装一个新的mysql实例并不意味着必须保留您的数据库。如果您正在处理大型项目,我建议您运行数据库的夜间备份。

票数 13
EN

Stack Overflow用户

发布于 2015-03-04 22:03:00

我也遇到了同样的问题,为了解决这个问题,我在my.ini中添加了下面这行代码

代码语言:javascript
运行
复制
innodb_force_recovery = 1
票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17761931

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档