SELECT
trx_id AS `事务ID`,
trx_state AS `事务状态`,
trx_requested_lock_id AS `事务需要等待的资源`,
trx_wait_started AS `事务开始等待时间`,
trx_tables_in_use AS `事务使用表`,
trx_tables_locked AS `事务拥有锁`,
trx_rows_locked AS `事务锁定行`,
trx_rows_modified AS `事务更改行`
FROM
information_schema.innodb_trx SELECT
lock_id AS `锁ID`,
lock_trx_id AS `拥有锁的事务ID`,
lock_mode AS `锁模式 `,
lock_type AS `锁类型`,
lock_table AS `被锁的表`,
lock_index AS `被锁的索引`,
lock_space AS `被锁的表空间号`,
lock_page AS `被锁的页号`,
lock_rec AS `被锁的记录号`,
lock_data AS `被锁的数据`
FROM
information_schema.innodb_locks
SELECT
requesting_trx_id AS `请求锁的事务ID`,
requested_lock_id AS `请求锁的锁ID`,
blocking_trx_id AS `当前拥有锁的事务ID`,
blocking_lock_id AS `当前拥有锁的锁ID`
FROM
innodb_lock_waits
mysql有最大连接数设置,如果,没有关闭连接,会导致阻塞。可以使用下面命令查看最大连接数:
show variables like '%max_connections%'
查看当前mysql连接数:
show processlist
mysql 连接线程被阻塞怎么解决1. 通过调用mysql_library_init(),初始化MySQL库。库可以是mysqlclient C客户端库,或mysqld嵌入式服务器库,具体情况取决于应用程序是否与“-libmysqlclient”或“-libmysqld”标志链接。 2. 通过调用mysql_init()初始化连接处理程序,并通过调用mysql_real_connect()连接到服务器。 3. 发出SQL语句并处理其结果。(在下面的讨论中,详细介绍了使用它的方法)。 4. 通过调用mysql_close(),关闭与MySQL服务器的连接。 5. 通过调用mysql_library_end(),结束MySQL库的使用。欢迎分享,转载请注明来源:内存溢出
评论列表(0条)