mysql查询进程、导入数据包大小设置、metadata lock
mysql查询进程、导入数据包大小设置
zoerywzhou@163.com
http://www.cnblogs.com/swje/
作者:Zhouwan
2017-12-27
查询正在执行的进程:
- 进入mysql,show processlist;
mysql> show processlist;
+-----+------+-----------------+------+---------+------+----------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+-----------------+------+---------+------+----------+------------------+
| 113 | root | localhost:56322 | NULL | Sleep | 7872 | | NULL |
| 114 | root | localhost:56323 | icbc | Sleep | 7013 | | NULL |
| 119 | root | localhost:56330 | icbc | Sleep | 5710 | | NULL |
| 148 | root | localhost:58305 | icbc | Query | 0 | starting | show processlist |
+-----+------+-----------------+------+---------+------+----------+------------------+
4 rows in set
- 杀死进程:
- kill id;
- eg: kill 113;
mysql中max_allowed_packet参数的配置方法(避免大数据写入或者更新失败)
MySQL根据配置文件会限制Server接受的数据包大小。有时候大的插入和更新会受 max_allowed_packet 参数限制,导致写入或者更新失败。
数据较大时,需要设置参数:max_allowed_packet
设置方法:
- 进入mysql,查看当前数据包大小。输入:show VARIABLES like '%max_allowed_packet%';
- 根据自己的数据需求,设置默认大小:set global max_allowed_packet = 2*1024*1024*100 (设为200M)
- 然后退出命令行,重启mysql服务,再进入,查看是否修改成功。输入:show VARIABLES like '%max_allowed_packet%';
MySQL中Waiting for table metadata lock的解决方法
参考链接:http://blog.csdn.net/u013235478/article/details/68062939