I just upgraded drupal core to 7.16 and am using MAMP in my local development environment. When I click on /admin/commerce/config/products-categories/add I get an sql error that prevents me from adding the category.

Additional uncaught exception thrown while handling exception.
Original

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 704 of /Applications/MAMP/htdocs/commerce/modules/node/node.module).
Additional

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => php [:db_insert_placeholder_2] => %type: !message in %function (line %line of %file). [:db_insert_placeholder_3] => a:6:{s:5:"%type";s:12:"PDOException";s:8:"!message";s:221:"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 ) ";s:9:"%function";s:19:"_node_types_build()";s:5:"%file";s:59:"/Applications/MAMP/htdocs/commerce/modules/node/node.module";s:5:"%line";i:704;s:14:"severity_level";i:3;} [:db_insert_placeholder_4] => 3 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://localhost:8888/commerce/admin/commerce/config/products-categories... [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => ::1 [:db_insert_placeholder_9] => 1351253606 ) in dblog_watchdog() (line 154 of /Applications/MAMP/htdocs/commerce/modules/dblog/dblog.module).

Comments

bojanz’s picture

Status: Active » Closed (duplicate)

This is a MAMP configuration issue.
See http://drupal.org/node/1787038#comment-6488434

thomaske’s picture

Thanks for the tip!

this is what worked for me.....

Posted by makokis on October 19, 2012 at 8:38pm new
Title: PDOException: SQLSTATE[HY000]: General error: 2006 MySQL » SOLVED - PDOException: SQLSTATE[HY000]: General error: 2006 MySQL

To implement the fix on your install do the following to the file:

/Applications/MAMP/Library/bin/mysqld_safe

edit the file "mysqld_safe"

open it and add at the end of the line 735 (aprox 730-740)
for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
"--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION" "--max_allowed_packet=268435456"
do

add at the end "--max_allowed_packet=268435456"

stop and restart mysql.

works for me !

arti123’s picture

Title: SQL error when trying to add a category » Additional uncaught exception thrown while handling exception.

Additional uncaught exception thrown while handling exception.

Original

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source AND s.context = :context AND s.textgroup = 'default'; Array ( [:language] => sv [:source] => No tokens available. [:context] => ) in locale() (line 676 of /home/…/modules/locale/locale.module).

Additional

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source AND s.context = :context AND s.textgroup = 'default'; Array ( [:language] => sv [:source] => %type: !message in %function (line %line of %file). [:context] => ) in locale() (line 676 of /home/…/modules/locale/locale.module).

Solution :-

Thank you........... Its work now :)

Go to xampp\mysql\binOpen my.iniChange "max_allowed_packet" from "1m" to
"16m" (or larger)Save my.ini Now restart MySql through the XAMPP
control panel.

arti123’s picture

Issue summary: View changes

fixed typo