Answers.Body: <p>After a long back and forth with support, we narrowed it down to corrupted CiviCRM tables. The corrupted tables weren't even in the same CiviCRM database that was having trouble, and they were causing phpMyAdmin to lose the DB connection in certain cases. Here's the process I used to fix things:</p>
  
  <ol>
  <li>Set your site to offline</li>
  <li>Go to a command line (I used Putty).</li>
  <li>Enter <code>mysqlcheck databasename_civicrm</code> to get a status report on all tables.</li>
  <li>The process may halt with an error message (or if no error message it'll tell you which are/aren't corrupted). In my case, when it halted, I assumed that the first unlisted table (alphabetically) was the problem table and dropped it (Important: Dropping means you're deleting it. It's a big deal. You'll want to have a backup ready and think about the implications for related tables).</li>
  <li>Drop the offending table(s). I used phpMyAdmin for this.</li>
  <li>Restore the offending table(s) from a viable backup.</li>
  <li>Enter <code>mysqlcheck databasename_civicrm</code> again to get a status report on all tables. Repeat the drop/restore process if necessary.</li>
  <li>Assuming you're in the clear, put your site back online.</li>
  </ol>
  
  <p>After I did this, all the processes that formerly gave the error no longer did so I consider it fixed.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-05T21:40:41.833Z
Answers.LastActivityDate: 2016-03-05T21:40:41.833Z
Answers.UserDisplayName: Eric H
Answers.Body: <p>This is an extremely generic error, which basically means "MySQL froze up", and you'll need to check your MySQL and system logs rather than/in addition to CiviCRM for answers.  Check your server's system logs to see if perhaps oom-killer decided to kill MySQL because you're out of memory.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-04T22:59:13.047Z
Answers.Text: You're correct. The error runs deeper than how CiviCRM is using mySQL, and is a basic mySQL problem. It's reported by an older mysqltuner, but not the new one oddly. I'm working with my hosting support and will post the solution.
Answers.UserDisplayName: Eric H
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-03T05:46:23.043Z
Answers.LastActivityDate: 2016-03-03T05:46:23.043Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I get the following error in various situations, detailed below. </p>
  
  <p><code>SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
  DB Error: unknown error</code></p>
  
  <p>I get it consistently when trying to enter the duplicate merging dialog; and I've gotten it occasionally when importing data, deleting events (without participants), and other routine tasks. It displays the message twice when the error happens (three times if watchdog is on). It's happening on multiple CiviCRM sites on the same server.</p>
  
  <p>The Googled consensus seems to be to increase max_allowed_packet in my.cnf but this hasn't helped in my case (it was 24M and is now at 64M). Restarting mySQL and the server itself have also not resolved the issue. Any suggestion is welcome. </p>
  
  <p>Backtrace when trying to enter the duplicate merging dialog:</p>
  
  <p>0 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Core/Error.php(182): CRM_Core_Error::backtrace()</p>
  
  <p>1 internal function: CRM_Core_Error::handle(Object(DB_Error))</p>
  
  <p>2 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))</p>
  
  <p>3 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: unknown error", -1, 16, (Array:2), "\nSELECT\n    table_name,\n    column_name\nFROM information_schema.key_colum...")</p>
  
  <p>4 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-1, 16, (Array:2), "\nSELECT\n    table_name,\n    column_name\nFROM information_schema.key_colum...")</p>
  
  <p>5 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -1, NULL, NULL, "\nSELECT\n    table_name,\n    column_name\nFROM information_schema.key_colum...", "DB_Error", TRUE)</p>
  
  <p>6 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-1, NULL, NULL, NULL, "2006 ** MySQL server has gone away")</p>
  
  <p>7 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()</p>
  
  <p>8 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("\nSELECT\n    table_name,\n    column_name\nFROM information_schema.key_colum...")</p>
  
  <p>9 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/packages/DB/DataObject.php(2442): DB_common->query("\nSELECT\n    table_name,\n    column_name\nFROM information_schema.key_colum...")</p>
  
  <p>10 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("\nSELECT\n    table_name,\n    column_name\nFROM information_schema.key_colum...")</p>
  
  <p>11 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("\nSELECT\n    table_name,\n    column_name\nFROM information_schema.key_colum...")</p>
  
  <p>12 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Core/DAO.php(1192): CRM_Core_DAO->query("\nSELECT\n    table_name,\n    column_name\nFROM information_schema.key_colum...", TRUE)</p>
  
  <p>13 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(207): CRM_Core_DAO::executeQuery("\nSELECT\n    table_name,\n    column_name\nFROM information_schema.key_colum...")</p>
  
  <p>14 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(166): CRM_Dedupe_Merger::cidRefs()</p>
  
  <p>15 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(1102): CRM_Dedupe_Merger::getActiveRelTables("19986")</p>
  
  <p>16 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Contact/Form/Merge.php(193): CRM_Dedupe_Merger::getRowsElementsAndInfo("19985", "19986")</p>
  
  <p>17 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Core/Form.php(455): CRM_Contact_Form_Merge->preProcess()</p>
  
  <p>18 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(94): CRM_Core_Form->buildForm()</p>
  
  <p>19 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Contact_Form_Merge), "display")</p>
  
  <p>20 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Merge), "display")</p>
  
  <p>21 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Core/Controller.php(353): HTML_QuickForm_Page->handle("display")</p>
  
  <p>22 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(115): CRM_Core_Controller->run()</p>
  
  <p>23 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Core/Invoke.php(286): CRM_Utils_Wrapper->run("CRM_Contact_Form_Merge", "Merge Contact", NULL)</p>
  
  <p>24 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))</p>
  
  <p>25 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))</p>
  
  <p>26 /home/domainname/public_html/subdomainname/sites/all/modules/civicrm/drupal/civicrm.module(489): CRM_Core_Invoke::invoke((Array:3))</p>
  
  <p>27 internal function: civicrm_invoke("contact", "merge")</p>
  
  <p>28 /home/domainname/public_html/subdomainname/includes/menu.inc(519): call_user_func_array("civicrm_invoke", (Array:2))</p>
  
  <p>29 /home/domainname/public_html/subdomainname/index.php(21): menu_execute_active_handler()</p>
  
  <p>30 {main}</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-02T16:51:02.417Z
Comments.Text: try removing max_allowed_packet line from my.cnf file so the server will pick up default value (unlimited) -
Comments.UserDisplayName: Ramesh - ARTECH Consultancy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-02T21:13:59.427Z
Comments.Text: Thank you, but there's no change after applying that setting (and restarting mysql).
Comments.UserDisplayName: Eric H
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-02T22:38:35.863Z
Comments.Text: To add a dimension to this, it's happening in mySQL 5.6 and I'm considering an upgrade to MariaDB 10 as a possible solution since mySQL has given me many headaches.
Comments.UserDisplayName: Eric H
Tags: <error><mysql>
Title: General Error 2006
ThreadText: # General Error 2006
  
  (Asked by: username_0 on 2016-03-02)
  
  I get the following error in various situations, detailed below.
  
  `SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
  DB Error: unknown error`
  
  I get it consistently when trying to enter the duplicate merging dialog; and I've gotten it occasionally when importing data, deleting events (without participants), and other routine tasks. It displays the message twice when the error happens (three times if watchdog is on). It's happening on multiple CiviCRM sites on the same server.
  
  The Googled consensus seems to be to increase max\_allowed\_packet in my.cnf but this hasn't helped in my case (it was 24M and is now at 64M). Restarting mySQL and the server itself have also not resolved the issue. Any suggestion is welcome.
  
  Backtrace when trying to enter the duplicate merging dialog:
  
  0 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Core/Error.php(182): CRM\_Core\_Error::backtrace()
  
  1 internal function: CRM\_Core\_Error::handle(Object(DB\_Error))
  
  2 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/packages/PEAR.php(931): call\_user\_func((Array:2), Object(DB\_Error))
  
  3 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/packages/DB.php(976): PEAR\_Error->PEAR\_Error("DB Error: unknown error", -1, 16, (Array:2), "\nSELECT\n table\_name,\n column\_name\nFROM information\_schema.key\_colum...")
  
  4 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/packages/PEAR.php(564): DB\_Error->DB\_Error(-1, 16, (Array:2), "\nSELECT\n table\_name,\n column\_name\nFROM information\_schema.key\_colum...")
  
  5 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -1, NULL, NULL, "\nSELECT\n table\_name,\n column\_name\nFROM information\_schema.key\_colum...", "DB\_Error", TRUE)
  
  6 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/packages/DB/mysql.php(895): DB\_common->raiseError(-1, NULL, NULL, NULL, "2006 \*\* MySQL server has gone away")
  
  7 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/packages/DB/mysql.php(328): DB\_mysql->mysqlRaiseError()
  
  8 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/packages/DB/common.php(1216): DB\_mysql->simpleQuery("\nSELECT\n table\_name,\n column\_name\nFROM information\_schema.key\_colum...")
  
  9 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/packages/DB/DataObject.php(2442): DB\_common->query("\nSELECT\n table\_name,\n column\_name\nFROM information\_schema.key\_colum...")
  
  10 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/packages/DB/DataObject.php(1634): DB\_DataObject->\_query("\nSELECT\n table\_name,\n column\_name\nFROM information\_schema.key\_colum...")
  
  11 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Core/DAO.php(325): DB\_DataObject->query("\nSELECT\n table\_name,\n column\_name\nFROM information\_schema.key\_colum...")
  
  12 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Core/DAO.php(1192): CRM\_Core\_DAO->query("\nSELECT\n table\_name,\n column\_name\nFROM information\_schema.key\_colum...", TRUE)
  
  13 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(207): CRM\_Core\_DAO::executeQuery("\nSELECT\n table\_name,\n column\_name\nFROM information\_schema.key\_colum...")
  
  14 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(166): CRM\_Dedupe\_Merger::cidRefs()
  
  15 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(1102): CRM\_Dedupe\_Merger::getActiveRelTables("19986")
  
  16 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Contact/Form/Merge.php(193): CRM\_Dedupe\_Merger::getRowsElementsAndInfo("19985", "19986")
  
  17 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Core/Form.php(455): CRM\_Contact\_Form\_Merge->preProcess()
  
  18 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(94): CRM\_Core\_Form->buildForm()
  
  19 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM\_Core\_QuickForm\_Action\_Display->perform(Object(CRM\_Contact\_Form\_Merge), "display")
  
  20 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML\_QuickForm\_Controller->handle(Object(CRM\_Contact\_Form\_Merge), "display")
  
  21 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Core/Controller.php(353): HTML\_QuickForm\_Page->handle("display")
  
  22 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(115): CRM\_Core\_Controller->run()
  
  23 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Core/Invoke.php(286): CRM\_Utils\_Wrapper->run("CRM\_Contact\_Form\_Merge", "Merge Contact", NULL)
  
  24 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM\_Core\_Invoke::runItem((Array:13))
  
  25 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM\_Core\_Invoke::\_invoke((Array:3))
  
  26 /home/domainname/public\_html/subdomainname/sites/all/modules/civicrm/drupal/civicrm.module(489): CRM\_Core\_Invoke::invoke((Array:3))
  
  27 internal function: civicrm\_invoke("contact", "merge")
  
  28 /home/domainname/public\_html/subdomainname/includes/menu.inc(519): call\_user\_func\_array("civicrm\_invoke", (Array:2))
  
  29 /home/domainname/public\_html/subdomainname/index.php(21): menu\_execute\_active\_handler()
  
  30 {main}
  
  **Tags:** error, mysql
  
  > **Comments:**
  > **username_1**: try removing max_allowed_packet line from my.cnf file so the server will pick up default value (unlimited) -  
  > **username_0**: Thank you, but there's no change after applying that setting (and restarting mysql).  
  > **username_0**: To add a dimension to this, it's happening in mySQL 5.6 and I'm considering an upgrade to MariaDB 10 as a possible solution since mySQL has given me many headaches.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2016-03-05. Score: 2 | Accepted answer
  
  After a long back and forth with support, we narrowed it down to corrupted CiviCRM tables. The corrupted tables weren't even in the same CiviCRM database that was having trouble, and they were causing phpMyAdmin to lose the DB connection in certain cases. Here's the process I used to fix things:
  
  1. Set your site to offline
  2. Go to a command line (I used Putty).
  3. Enter `mysqlcheck databasename_civicrm` to get a status report on all tables.
  4. The process may halt with an error message (or if no error message it'll tell you which are/aren't corrupted). In my case, when it halted, I assumed that the first unlisted table (alphabetically) was the problem table and dropped it (Important: Dropping means you're deleting it. It's a big deal. You'll want to have a backup ready and think about the implications for related tables).
  5. Drop the offending table(s). I used phpMyAdmin for this.
  6. Restore the offending table(s) from a viable backup.
  7. Enter `mysqlcheck databasename_civicrm` again to get a status report on all tables. Repeat the drop/restore process if necessary.
  8. Assuming you're in the clear, put your site back online.
  
  After I did this, all the processes that formerly gave the error no longer did so I consider it fixed.
  
  
  ---
  
  ### Answer by username_2 on 2016-03-03. Score: 1
  
  This is an extremely generic error, which basically means "MySQL froze up", and you'll need to check your MySQL and system logs rather than/in addition to CiviCRM for answers. Check your server's system logs to see if perhaps oom-killer decided to kill MySQL because you're out of memory.
  
  > **Comments:**
  > **username_0**: You're correct. The error runs deeper than how CiviCRM is using mySQL, and is a basic mySQL problem. It's reported by an older mysqltuner, but not the new one oddly. I'm working with my hosting support and will post the solution.  
  
  ---
  
  