mysql查询进程、导入数据包大小设置

时间:2021-11-25 09:21:00

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

  • 杀死进程:

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%';