Not sure if this a problem with my MySQL or a conflict with Drupal Commerce. Since adding Drupal Commerce, I cannot add or edit a non-Commerce content types. I can still add/edit Commerce product types.

Here is the error that I get when trying to edit a standard 'Basic page' content type:
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT * FROM {commerce_product_type}; Array ( ) in commerce_product_ui_commerce_product_type_info() (line 322 of /Applications/MAMP/htdocs/drupal/sites/all/modules/commerce/modules/product/commerce_product_ui.module).

If I try to add a new content type (not a Commerce type, but a regular content type), I get this error:
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT nt.* FROM {node_type} nt WHERE (disabled = :db_condition_placeholder_0) ORDER BY nt.type ASC; Array ( [:db_condition_placeholder_0] => 0 ) in _node_types_build() (line 706 of /Applications/MAMP/htdocs/drupal/modules/openid/node/node.module).

Comments

rfay’s picture

The most common reason for "Mysql server has gone away" is the max_packet_size setting. If you haven't updated that already, you'll want to.

http://drupal.org/node/186384#comment-3062828

You'll want to look at the Mysql docs as well: http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

[mysqld]
max_allowed_packet      = 64M
rszrama’s picture

hehe This error message always strikes me as a sad discovery by PHP. It's like it just lost its best friend and all it can bring itself to divulge is that the "MySQL server has gone away." I feel like it should use a sad face, too.

Sunflowers11’s picture

Thank you rfay. I set max_allowed_packet in startMySql.sh and that did the trick.

rszrama - funny comment.

rszrama’s picture

Status: Active » Fixed

Glad it's fixed. : )

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

avrilev’s picture

Worked for me as well.

Thanks guys.

Avri

marthinal’s picture

If you are using MAMP here is a good post to fix the problem:

http://forum.mamp.info/viewtopic.php?f=2&t=14115#p30606

rszrama’s picture

w00t! I just had this problem after updating MAMP and the fix worked great for me. First I actually had to copy the example MySQL .cnf file to conf/my.cnf and then edit the max_packet_size. All is well.

joshmiller’s picture

And #7 was helpful for me as well :D

I did the following:

vim /Applications/MAMP/Library/bin/mysqld_safe
:730
i
[pasted "--max_allowed_packet=268435456" at the end of the line]
:wq

Then I restarted MAMP :D

news4u’s picture

the above didnt worked for me since my server version does not support the variable
But i used
max_execution_time = 60
and it worked
But correct if am making mistakes or if it will later have evfect on my server
thank you