C++ insert into mysql Got a packet bigger than 'max_allowed_packet' bytes (MySQL error code: 1153, SQLState: 08S01 )

1.cd /etc/mysql/

sudo vim mysql.conf.d

 

 

 2

 

 

3.Move to mysqld.cnf and enter;

 

 

4.add the follow clause and add its max_allowed_packet value to 1000M

max_allowed_packet=1000M

 

 

 

 

5.Save and quit

6.Restart mysql

sudo service mysql restart

7.login in mysql again

sudo mysql -u root -p

8.show databases;use myDB;show tables;

 

 

Through above steps we had ajust the max_allowed_packet to 1000M so that we can insert to table in bulk within big data capacity.

 

9.I'll insert into table per 1M rows data in bulk once.

time ./h1 1000000

 

 

10.Validate result in table 

select * from mt;

 

 

 

 

As the snapshot illustrates it can work now.

 

posted @   FredGrit  阅读(32)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示