Hailwood
Hailwood

Reputation: 92691

Run large sql script

I have just reloaded my laptop and am now trying to setup my localhost again.

Currently I am trying to re-setup the database.

the issue is,

The script is 169,328 KB.

This keeps crashing whatever I use to run the query and I get the error: The mysql Server has gone away.


Seems everyone is suggesting splitting the script. Instead as this is only me setting my localhost back up, I have temporarily increased the max_packet_size.

Upvotes: 1

Views: 620

Answers (2)

p.campbell
p.campbell

Reputation: 100647

If you're looking to avoid the err message, consider one of these remedies:

  • ensure that your environment or commands aren't causing this issue. Causes for MySQL gone-away.
  • split your large script into smaller scripts. You could then run those in sequence.

Upvotes: 1

duffymo
duffymo

Reputation: 309008

This would explain the error.

Perhaps you should open the script and see if you can chunk it into smaller, more manageable pieces.

I don't know what you're doing about transactions, but perhaps the rollback segment (or its MySQL equivalent) is getting too large. If that's the case, break the script into several transactions that you can safely commit individually.

Upvotes: 2

Related Questions