MySQL Dump等待表元数据锁定 [英] MySQL Dump waiting for table metadata lock

查看:85
本文介绍了MySQL Dump等待表元数据锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按照以下方式进行mysqldump:

I am trying to do a mysqldump along the lines of:

mysqldump -u root -p db > C:\FileLocation

但是,当我运行命令时,它永远不会完成.因此,我使用了:SHOW PROCESSLIST;看看发生了什么.在我的转储查询状态下,状态显示为:等待表元数据锁定".数据库中只有两个其他进程在运行(除了SHOW PROCESSLIST命令之外),两个进程都在休眠.

However, when I run the command it never finishes. I therefore used: SHOW PROCESSLIST; to see what was going on. In the state of my dump query, the state reads: 'Waiting for table metadata lock'. There are only two other processes running on the database (besides the SHOW PROCESSLIST command), both of which are sleeping.

我尝试杀死其他两个进程,然后进行对我有用的转储.但是,无论两个进程是否正常运行,我都希望转储能够正常工作.有办法解决吗?

I tried killing the other two processes and then doing the dump which worked for me. However, I'd like the dump to work regardless of whether the two processes working. Is there a way to go about that?

推荐答案

设法最终弄清楚了...

Managed to figure it out in the end...

我要做的就是在原始查询的开头添加:--single-transaction=TRUE. IE浏览器:

All I had to do was add: --single-transaction=TRUE to the start of my original query. IE:

mysqldump --single-transaction=TRUE -u root -p db > C:\FileLocation

这允许进程运行而不必锁定表.

Which allows the process to run without having to lock tables.

这篇关于MySQL Dump等待表元数据锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆