1. Description of the problem
A situation in which the lock table may be encountered during the use of the database, resulting in timeouts when other processes access the same table. Specifically, use the following command in MySQL
SHOW processlist
Show results as
Where the Status column represents the query state of the statement, and if the value is locked, the query is locked by another query. The host represents the hosts information that issued the query statement, and the locked query is on a TCP connection made by Port 38292 on the 192.168.1.152 host. Information about the locked statement is given in the info column.
How do you find information about the process in which the locked SQL statement is based on this information to help with Debug?
2. Workaround A. Depending on the TCP port number, view the process PID method one: Lsof
LSOF-PNL +m-i4 | grep 38292
Method Two: Netstat
NETSTAT-ANP | grep 38292
Execute the above statement on the 192.168.1.152 host, as shown in the two methods to obtain the 38292 port corresponding to the process PID is 11882
B. Depending on the PID, view process information execute the following command on the 192.168.1.152 host to view process information
PS aux | grep 11882
As shown, you can view basic information such as a process-initiated command
According to the above information, the MySQL Query lock table problem can be checked, for further debugging program to provide the necessary information.
Find process information that causes MySQL queries to be locked under Linux