Solved

MySQL Server Has Gone Away or "Elvis Has Left the Building!"

Posted on 2015-02-13
10
97 Views
Last Modified: 2015-02-23
I've got sql file I'm trying to import into my database using phpMyAdmin. Cake and Ice Cream, right? The sql file is a little over 6MB. Every time I attempt to import it, I get a message that says "MySQL server has gone away.

I've been able to access my.ini and I changed the read_buffer_size to 8 M and the key_buffer_size to 32M. I chose these settings based on what I able to learn via google. Still getting the same error which tells me that I'm missing something.

What do I need to change?

Thanks!
0
Comment
Question by:brucegust
  • 6
  • 4
10 Comments
 
LVL 12

Expert Comment

by:Phil Phillips
Comment Utility
Try changing wait_timeout and max_allowed_packet.  For testing, you can go big with:

wait_timeout = 600
max_allowed_packet = 128M

Open in new window

0
 

Author Comment

by:brucegust
Comment Utility
Phil! Thanks for getting back with me!

It didn't work, but let me ask you this:

First of all, I'm using my.ini as opposed to my.cnf. From what I can gather, it's the same thing, it just depends on your operating system, correct?

Second, on my my.ini, I see a bunch of lines prefaced with "Uncomment the following if you are using InnoDB tables:

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = C:\mysql\data/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = C:\mysql\data/
#innodb_log_arch_dir = C:\mysql\data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 600

When I look at myPhpAdmin at I'm perusing the "type" of tables that I have, I see "InnoDB." Do I need to uncomment those lines?

BTW: I appreciate your help. I'm trying to get this app live today and it's nothing more than making a couple of tweaks and uploading some tables to a database. I've never encountered this error and it's killin' me!

What do you think?
0
 
LVL 12

Expert Comment

by:Phil Phillips
Comment Utility
On Windows, my.ini will work.  You can also run 'SHOW VARIABLES' as a query just to make sure that the options are being set.

Yes, you can uncomment those if you are using InnoDB, and go ahead and tweak the memory settings depending on the size of your RAM (refer to the comments within the config file).  Though, I'm not sure that will fix the problem.  For me, it's only really been the network settings that caused that particular issue.
0
 

Author Comment

by:brucegust
Comment Utility
OK, Phil! Check this out.

I had an epiphane. I took the same sql file and attempted it upload to another database using phpmyAdmin on another computer. It took a while, but it worked.

Copied the my.ini file from that computer and pasted it into the configuration I've got on this box.

Ran it and got the same message: "MySQL server has gone away."

You mentioned "network settings." Mind you this is my localhost. Can you think of anything else?
0
 

Author Comment

by:brucegust
Comment Utility
Also, if I uncomment the lines pertaining to innodb..., nothing works. phpmyAdmin, anything related to the database just flat out quits. Add the "#" back in, gold. But I can't change those settings and have the thing work.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 12

Expert Comment

by:Phil Phillips
Comment Utility
The network settings I was referring to were 'wait_timeout' and 'max_allowed_packet'.  Check to see through the 'SHOW VARIABLES' query that the settings are actually applied.

An ugly hack would be to try to split up the dump into smaller files (but you shouldn't have to do that...)
0
 

Author Comment

by:brucegust
Comment Utility
wait_timeout is set to 28800 and max_allowed_packet is 1048576

When I compare those values to the my.ini file that I've been manipulating, the max_allowed_packet is:
 
max_allowed_packet = 16M

...and the wait timeout is:

#innodb_lock_wait_timeout = 50

Now, Phil, something doesn't smell right here. The variables that are listed on the my.ini file don't seem to match what's actually being perceived by system, yes? Is there a discrepancy? BTW: I'm accessing my.ini by highlighting the my.ini option in the WAMP interface.

thoughts?
0
 
LVL 12

Accepted Solution

by:
Phil Phillips earned 500 total points
Comment Utility
Yes, looks like you're either editing the wrong my.ini file, or there's an override somewhere.  Also, make sure you are restarting MySQL after making changes ;).

Just to get things working, you can try executing these commands in MySQL:

SET GLOBAL max_allowed_packet=134217728;
SET GLOBAL wait_timeout=600;

Open in new window


That should at least force those settings, and you can try the import.  If that works, then you can at least continue on and take your time in figuring out which conf file to edit :).
0
 

Author Comment

by:brucegust
Comment Utility
Changed the settings, Phil, and I was stoked because I figured this was the ultimate way in which to establish some settings that would pave the way for what needed to be done.

Nothing.

Same error.

What do you think?
0
 

Author Comment

by:brucegust
Comment Utility
I wasn't able to get it to work, but I did find a workaround so I was able to accomplish what I needed to get done. Thanks. Phil, for helping me out with the MySQL code that allowed me to directly affect the max_allowed_packet setting and the max_timeout variable.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now