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.