Brn.Rajoriya
Brn.Rajoriya

Reputation: 1544

MYSQL has gone away after inserting more than 100 000 values

MYSQL has gone away after inserting more than 100 000 values. I committed this problem when I was working with WordPress and MySQL. it is through an error when data had over up to 100k.

Edited : I didn't use indexing and each insert query was creating new db connection.

Upvotes: 0

Views: 114

Answers (3)

Alexander Gelbukh
Alexander Gelbukh

Reputation: 2240

Supposing you call MySQL from PHP, you should split the data in smaller chunks. After more than thousand values or so a call to MySQL from PHP often timeouts.

Or, you should increase the timeout in PHP:

ini_set ('max_execution_time',    200); // seconds, default: 30
ini_set ('mysql.connect_timeout', 200); // seconds, default: 60

Upvotes: 1

Avinash Babu
Avinash Babu

Reputation: 6252

This can be done by adding some configuration on the php.ini basic file.

upload_max_filesize = 2M // you can choose the size

max_execution_time = 60 // set execution time according to you

Upvotes: 0

Khushboo
Khushboo

Reputation: 1817

Try by increasing the following values in mysql ini file

max_allowed_packet = 64M

sort_buffer_size = 2M
net_buffer_length = 2M
read_buffer_size = 256K
read_rnd_buffer_size = 64M
myisam_sort_buffer_size = 64M

Upvotes: 1

Related Questions