首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MySQL服务不运行

问MySQL服务不运行
EN

Stack Overflow用户
提问于 2015-11-19 05:17:17
回答 1查看 524关注 0票数 1

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

#2002 -由于目标机器主动拒绝连接,因此无法连接。

这是日志错误:

代码语言:javascript
复制
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文件,但问题仍然存在。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-11-19 06:31:30

服务器上的MySQL端口要么是防火墙,要么是mysql没有监听该端口。“主动拒绝”是指目标机器返回“拒绝连接”。

更改此文件:"C:\wamp\bin\mysqlmysql_version\my.ini“

代码语言:javascript
复制
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock

和MySQL服务器wampmysqld

代码语言:javascript
复制
port = 3306
socket = /tmp/mysql.sock

您可以将端口号默认值3306更改为3309 (类似)。

更新

mysql.sock不是一个简单的文件,您只需创建它。MySQL将在一开始就“自己”创建。尝试启动MySQL,然后为我们提供一个完整的mysqld.log。

我假设它是这样的,可以在其中找到解决办法/解决方案:

代码语言:javascript
复制
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)如果不需要表,或者可以从备份中恢复表,则可以删除.ibd文件,InnoDB将执行正常的崩溃恢复并忽略该表。

3)如果文件系统或磁盘出现故障,并且无法删除.ibd文件,则可以在my.cnf中设置innodb_force_recovery >0,并强制InnoDB在这里继续崩溃恢复:

代码语言:javascript
复制
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. 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33795780

复制
相关文章

相似问题

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