MySQL 服务没有 运行

MySQL service doesn't run

我对 MySQL 有疑问。 WAMP 是橙色的,服务在线,但不是 MySQL。它显示以下错误:

#2002 - No connection could be made because the target machine actively refused it.

这是日志错误:

2015-11-18 22:13:24 7408 [Note] Plugin 'FEDERATED' is disabled.
2015-11-18 22:13:24 7408 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-11-18 22:13:24 7408 [Note] InnoDB: The InnoDB memory heap is disabled
2015-11-18 22:13:24 7408 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-11-18 22:13:24 7408 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-11-18 22:13:24 7408 [Note] InnoDB: Not using CPU crc32 instructions
2015-11-18 22:13:24 7408 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-11-18 22:13:24 7408 [Note] InnoDB: Completed initialization of buffer pool
2015-11-18 22:13:24 7408 [Note] InnoDB: Highest supported file format is Barracuda.
2015-11-18 22:13:24 7408 [Note] InnoDB: The log sequence numbers 101407365 and 101407365 in ibdata files do not match the log sequence number 101451472 in the ib_logfiles!
2015-11-18 22:13:24 7408 [Note] InnoDB: Database was not shutdown normally!
2015-11-18 22:13:24 7408 [Note] InnoDB: Starting crash recovery.
2015-11-18 22:13:24 7408 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-11-18 22:13:24 7408 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace catalog_estudio/ost_qacomments uses space ID: 70 at filepath: .\catalog_estudio\ost_qacomments.ibd. Cannot open tablespace osticket/ost_content which uses space ID: 70 at filepath: .\osticket\ost_content.ibd
InnoDB: Error: could not open single-table tablespace file .\osticket\ost_content.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.

我试图找到 my.cnf 但它不存在。我删除了 .ibd 文件,但问题仍然存在。

服务器上的

MySQL 端口被防火墙保护,或者 mysql 未在该端口上侦听。 "actively refusing" 表示目标机器返回了 "connection refused".

更改此文件:"C:\wamp\bin\mysql[mysql_version]\my.ini"

[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock

和MySQL服务器 [wampmysqld]

port = 3306
socket = /tmp/mysql.sock

您可以将端口号默认 3306 更改为 3309 之类的。

更新

mysql.sock 不是一个您可以创建的简单文件。 MySQL 将在 "itself" 开始时创建。 尝试开始 MySQL 然后为我们提供完整的 mysqld.log.

我假设它是以下内容并且可以在其中找到 workaround/solution:

InnoDB: Error: could not open single-table tablespace file .\mysql\slave_worker_info.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. 

1) 如果文件存在权限问题,mysqld无法打开文件,请修改权限。

2) 如果 table 不需要,或者你可以从备份中恢复它,那么你可以删除 .ibd 文件,InnoDB 将进行正常的崩溃恢复并忽略 table.

3)如果文件系统或磁盘坏了,无法删除.ibd文件,可以在my.cnf中设置innodb_force_recovery > 0,强制InnoDB在此处继续崩溃恢复:

1) In [mysqld] section, add the following line: 
innodb_force_recovery = 1 
2) Save the file and try starting MySQL. 
3) when recovery is finished, remove that line which you just added and restart MySQL.