简体   繁体   English

mysql:未知变量'innodb_lock_wait_timeout = 500'

[英]mysql: unknown variable 'innodb_lock_wait_timeout=500'

I have a query, that takes time to execute, because I'm importing the geonames table 我有一个查询,要花一些时间执行,因为我要导入地名表

LOAD DATA LOCAL INFILE 'allCountries.txt'
INTO TABLE geoname
CHARACTER SET 'UTF8'
(geonameid, name, asciiname, alternatenames, latitude, longitude, fclass, fcode, country, cc2, admin1, admin2, admin3, admin4, population, elevation, gtopo30, timezone, moddate);

However, if I execute the query, I always get 但是,如果执行查询,我总是会得到

Lock wait timeout exceeded; try restarting transaction
vagrant@homestead:~/work/homestead/project/bin$

So I tried to increase the lock time out. 因此,我尝试增加锁定时间。 The documentation states here: http://dev.mysql.com/doc/refman/5.0/en/innodb-parameters.html#sysvar_innodb_lock_wait_timeout that the CLI-parameter is --innodb_lock_wait_timeout=# , but when I set it in my query 文档在这里声明: http : --innodb_lock_wait_timeout=# CLI参数是--innodb_lock_wait_timeout=# ,但是当我在查询中设置它时

mysql -ugeonames -psecret --local-infile=1 --innodb_lock_wait_timeout=500 geonames < geonames_import_data.sql

I'm getting the error 我遇到了错误

mysql: unknown variable 'innodb_lock_wait_timeout=500'

But my MySQL version mysql Ver 14.14 Distrib 5.6.19, for debian-linux-gnu (x86_64) using EditLine wrapper should support this setting, right? 但是我的MySQL版本mysql Ver 14.14 Distrib 5.6.19, for debian-linux-gnu (x86_64) using EditLine wrapper应该支持此设置,对吗?

When I set it globally like SET GLOBAL innodb_lock_wait_timeout = 500; 当我像SET GLOBAL innodb_lock_wait_timeout = 500;这样全局SET GLOBAL innodb_lock_wait_timeout = 500; and then read the value with show variables like '%lock_wait%'; 然后使用show variables like '%lock_wait%';读取该值show variables like '%lock_wait%'; I'm getting the correct values 我得到正确的值

+--------------------------+----------+
| Variable_name            | Value    |
+--------------------------+----------+
| innodb_lock_wait_timeout | 500      |
| lock_wait_timeout        | 31536000 |
+--------------------------+----------+

How do I use it on the command line though? 我如何在命令行上使用它?

My Versions: 我的版本:

select @@version // 5.6.19-0ubuntu0.14.04.1
mysql --version // mysql  Ver 14.14 Distrib 5.6.19, for debian-linux-gnu (x86_64) using  EditLine wrapper

You probably have an older version of mysql or at least the cli is old, probably from the v5.0 series. 您可能具有较旧的mysql版本,或者至少是cli旧版本(可能来自v5.0系列)。 If you check out the documentation you linked yourself, then you can see the following at innodb_lock_wait_timeout description : 如果您查看自己链接的文档,则可以在innodb_lock_wait_timeout description中看到以下内容:

Name :innodb_lock_wait_timeout 名称:innodb_lock_wait_timeout

Variable Scope: Global 可变范围:全球

Dynamic Variable: No 动态变量:

The dynamic variable no means that the variable cannot be set on the fly, only in the my.ini and the value will only change if the server is restarted. 动态变量no意味着不能在my.ini中动态设置该变量,并且仅在重新启动服务器后该值才会更改。 You will get the error message you described if you try to change the variable dynamically. 如果尝试动态更改变量,则会收到描述的错误消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM