Heim  >  Artikel  >  Backend-Entwicklung  >  php连接mysql后应该会自动断开吧,但是用GET_LOCK阻塞了?

php连接mysql后应该会自动断开吧,但是用GET_LOCK阻塞了?

WBOY
WBOYOriginal
2016-10-22 00:14:301165Durchsuche

访问localhost/ci
代码如下(就是上了个锁)

php连接mysql后应该会自动断开吧,但是用GET_LOCK阻塞了?
完了后,
我用Navicat建立一个连接,调命令行,加锁,发现被阻塞了:

php连接mysql后应该会自动断开吧,但是用GET_LOCK阻塞了?

为什么呢?php的那个连接应该被释放了啊
ps:
环境为windows+nginx+php+mysql

回复内容:

访问localhost/ci
代码如下(就是上了个锁)

php连接mysql后应该会自动断开吧,但是用GET_LOCK阻塞了?
完了后,
我用Navicat建立一个连接,调命令行,加锁,发现被阻塞了:

php连接mysql后应该会自动断开吧,但是用GET_LOCK阻塞了?

为什么呢?php的那个连接应该被释放了啊
ps:
环境为windows+nginx+php+mysql

上锁以后要解锁

<code>unlock tables</code>

或者

<code>rollback</code>

<code>select release_lock('lock1');</code>

释放锁

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn