Answers.Body: <p>This indicates that MySQL has crashed.  Check your MySQL log for details, and considering increasing the number of open connections.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-24T18:08:46.733Z
Answers.Text: Thanks, I tried that, then I noticed this odd error in the MySQL logs:   [ERROR] /usr/sbin/mysqld: Out of memory (Needed 32 bytes)
  I certainly have 32 bytes free.  Have  been monitoring and plenty of free memory, no swapping happening.
Answers.UserDisplayName: Dan Jacobs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-26T02:30:47.403Z
Answers.Text: @DanJacobs That error indicates that MySQL wanted 32 bytes more than it had available.  Check `/etc/mysql/my.cnf` and files in `/etc/mysql/conf.d` for your MySQL settings (this is Debian/Ubuntu, not sure about other OSes/distros).  Is this an old server?  I see issues like this when I upgrade the OS but don't take the new default settings for MySQL and keep the old ones.  "Reasonable" defaults for memory allocation have changed over time - and it sounds like you can spare more RAM to MySQL.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-26T11:38:38.070Z
Answers.Text: Thanks, Jon, I had already massively upped the defaults.  Didn't work.
Answers.UserDisplayName: Dan Jacobs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-26T12:47:56.057Z
Answers.Text: upgraded the server to 4gb RAM and changed innodb_buffer_pool_size to 3G.  Same problem.
Answers.UserDisplayName: Dan Jacobs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-26T13:32:03.057Z
Answers.Text: ok, after upgrading the RAM and doing some more tuning of MySQL, I got the same error but also an error saying a table was corrupt (wordpress.log_civicrm_msg_template).  I turned off logging and dropped the table.  Now the upgrade has started to run!
Answers.UserDisplayName: Dan Jacobs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-27T00:08:14.403Z
Answers.Text: @DanJacobs Very glad to hear it!  Note that "massively upping the defaults" is actually the *cause* rather than *solution* to MySQL issues - which you probably learned today. e.g. increasing the innodb_buffer_pool_size is good for performance, but if you let MySQL allocate more RAM than there is available, you get an out-of-memory error.  OOM errors generally require you lower the RAM allocations
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-23T21:33:14.627Z
Answers.LastActivityDate: 2022-06-23T21:33:14.627Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I'm on wordpress 6.0, linux, upgrading from CiviCRM 5.36.0 to 5.50.3.</p>
  <p>When I try and run the upgrade script i.e. wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fupgrade&amp;reset=1</p>
  <p>I get the following error in my debug and it crashes:</p>
  <pre><code>[22-Jun-2022 19:05:42 Europe/London] PHP Fatal error:  Uncaught &lt;table style=&quot;border: 1px&quot; cellspacing=&quot;0&quot;&gt;
  &lt;tr&gt;&lt;td colspan=&quot;3&quot; style=&quot;background: #ff9999&quot;&gt; &lt;b&gt;PEAR_Exception&lt;/b&gt;: DB Error: no database selected in &lt;b&gt;/var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php&lt;/b&gt; on line &lt;b&gt;922&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td colspan=&quot;3&quot; style=&quot;background: #ff9999&quot;&gt;- &lt;b&gt;DB_Error&lt;/b&gt;: DB Error: no database selected in &lt;b&gt;unknown&lt;/b&gt; on line &lt;b&gt;unknown&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td colspan=&quot;3&quot; style=&quot;background-color: #aaaaaa; text-align: center; font-weight: bold;&quot;&gt;Exception trace&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td style=&quot;text-align: center; background: #cccccc; width:20px; font-weight: bold;&quot;&gt;#&lt;/td&gt;&lt;td style=&quot;text-align: center; background: #cccccc; font-weight: bold;&quot;&gt;Function&lt;/td&gt;&lt;td style=&quot;text-align: center; background: #cccccc; font-weight: bold;&quot;&gt;Location&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;0&lt;/td&gt;&lt;td&gt;CRM_Core_Error::exceptionHandler()&lt;/td&gt;&lt;td&gt;/var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:922&lt;/td&gt;&lt;/tr&gt;
  &lt;tr in /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php on line 955
  
  Jun 22 20:55:26  [debug] $backTrace = #0 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(441): CRM_Core_Error::backtrace(&quot;backTrace&quot;, TRUE)
  #1 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(PEAR_Exception))
  #2 /var/www/html/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke((Array:2))
  #3 /var/www/html/wp-includes/class-wp-hook.php(307): CiviCRM_For_WordPress-&gt;invoke(&quot;&quot;)
  #4 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook-&gt;apply_filters(&quot;&quot;, (Array:1))
  #5 /var/www/html/wp-includes/plugin.php(476): WP_Hook-&gt;do_action((Array:1))
  #6 /var/www/html/wp-admin/admin.php(259): do_action(&quot;toplevel_page_CiviCRM&quot;)
  #7 {main}
  
  
  Jun 22 20:55:28  [error] $Fatal Error Details = Array
  (
      [callback] =&gt; Array
          (
              [0] =&gt; CRM_Core_Error
              [1] =&gt; exceptionHandler
          )
  
      [code] =&gt; -14
      [message] =&gt; DB Error: no database selected
      [mode] =&gt; 16
      [debug_info] =&gt; SELECT * 
   FROM   `civicrm_component`   
   
   
   
   
   
   [nativecode=2006 ** MySQL server has gone away]
      [type] =&gt; DB_Error
      [user_info] =&gt; SELECT * 
   FROM   `civicrm_component`   
   
   
   
   
   
   [nativecode=2006 ** MySQL server has gone away]
      [to_string] =&gt; [db_error: message=&quot;DB Error: no database selected&quot; code=-14 mode=callback callback=CRM_Core_Error::exceptionHandler prefix=&quot;&quot; info=&quot;SELECT * 
   FROM   `civicrm_component`   
   
   
   
   
   
   [nativecode=2006 ** MySQL server has gone away]&quot;]
  )
  
  
  Jun 22 20:56:14  [debug] $backTrace = #0 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(954): CRM_Core_Error::backtrace(&quot;backTrace&quot;, TRUE)
  #1 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::exceptionHandler(Object(DB_Error))
  #2 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB.php(997): PEAR_Error-&gt;__construct(&quot;DB Error: no database selected&quot;, -14, 16, (Array:2), &quot;SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n [nativecode=2006 *...&quot;)
  #3 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error-&gt;__construct(-14, 16, (Array:2), &quot;SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n [nativecode=2006 *...&quot;)
  #4 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR::_raiseError(Object(DB_mysqli), NULL, -14, 16, (Array:2), &quot;SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n [nativecode=2006 *...&quot;, &quot;DB_Error&quot;, TRUE)
  #5 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php(1928): PEAR-&gt;__call(&quot;raiseError&quot;, (Array:7))
  #6 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php(936): DB_common-&gt;raiseError(-14, NULL, NULL, &quot;SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n [nativecode=2006 *...&quot;, &quot;2006 ** MySQL server has gone away&quot;)
  #7 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php(391): DB_mysqli-&gt;mysqliRaiseError(-14)
  #8 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php(1234): DB_mysqli-&gt;simpleQuery(&quot;SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n&quot;)
  #9 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2696): DB_common-&gt;query(&quot;SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n&quot;)
  #10 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(451): DB_DataObject-&gt;_query(&quot;SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n&quot;)
  #11 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Component.php(74): DB_DataObject-&gt;find(FALSE)
  #12 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Component.php(37): CRM_Core_Component::getComponents()
  #13 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Component.php(116): CRM_Core_Component::_info(FALSE)
  #14 /var/www/html/wp-content/plugins/civicrm-admin-utilities/includes/civicrm-admin-utilities-single.php(2269): CRM_Core_Component::getEnabledComponents()
  #15 /var/www/html/wp-includes/class-wp-hook.php(307): CiviCRM_Admin_Utilities_Single-&gt;shortcuts_menu_add(Object(WP_Admin_Bar))
  #16 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook-&gt;apply_filters(NULL, (Array:1))
  #17 /var/www/html/wp-includes/plugin.php(524): WP_Hook-&gt;do_action((Array:1))
  #18 /var/www/html/wp-includes/admin-bar.php(95): do_action_ref_array(&quot;admin_bar_menu&quot;, (Array:1))
  #19 /var/www/html/wp-includes/class-wp-hook.php(307): wp_admin_bar_render(&quot;&quot;)
  #20 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook-&gt;apply_filters(&quot;&quot;, (Array:1))
  #21 /var/www/html/wp-includes/plugin.php(476): WP_Hook-&gt;do_action((Array:1))
  #22 /var/www/html/wp-admin/admin-header.php(267): do_action(&quot;in_admin_header&quot;)
  #23 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/Base.php(312): require_once(&quot;/var/www/html/wp-admin/admin-header.php&quot;)
  #24 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System.php(202): CRM_Utils_System_Base-&gt;theme(&quot;&lt;div id=\&quot;crm-container\&quot; class=\&quot;crm-container\&quot; lang=\&quot;en\&quot; xml:lang=\&quot;en\&quot;...&quot;, FALSE, FALSE)
  #25 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(452): CRM_Utils_System::theme(&quot;&lt;div id=\&quot;crm-container\&quot; class=\&quot;crm-container\&quot; lang=\&quot;en\&quot; xml:lang=\&quot;en\&quot;...&quot;)
  #26 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(PEAR_Exception))
  #27 /var/www/html/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke((Array:2))
  #28 /var/www/html/wp-includes/class-wp-hook.php(307): CiviCRM_For_WordPress-&gt;invoke(&quot;&quot;)
  #29 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook-&gt;apply_filters(&quot;&quot;, (Array:1))
  #30 /var/www/html/wp-includes/plugin.php(476): WP_Hook-&gt;do_action((Array:1))
  #31 /var/www/html/wp-admin/admin.php(259): do_action(&quot;toplevel_page_CiviCRM&quot;)
  </code></pre>
  <p>any ideas?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-22T19:57:20.527Z
Comments.Text: Here is the entire backtrace:
Comments.UserDisplayName: Dan Jacobs
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-23T16:59:22.800Z
Comments.Text: Would really appreciated some suggestions, I have no idea what to do with this.
Comments.UserDisplayName: Dan Jacobs
Tags: <upgrade><civicrm-home>
Title: "DB Error: no database selected in unknown" when trying to upgrade Civicrm
ThreadText: # "DB Error: no database selected in unknown" when trying to upgrade Civicrm
  
  (Asked by: username_0 on 2022-06-22)
  
  I'm on wordpress 6.0, linux, upgrading from CiviCRM 5.36.0 to 5.50.3.
  When I try and run the upgrade script i.e. wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fupgrade&reset=1
  I get the following error in my debug and it crashes:
  [22-Jun-2022 19:05:42 Europe/London] PHP Fatal error:  Uncaught 
   PEAR_Exception: DB Error: no database selected in /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php on line 922
  - DB_Error: DB Error: no database selected in unknown on line unknown
  Exception trace
  #FunctionLocation
  0CRM_Core_Error::exceptionHandler()/var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:922
  invoke("")
  #4 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters("", (Array:1))
  #5 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action((Array:1))
  #6 /var/www/html/wp-admin/admin.php(259): do_action("toplevel_page_CiviCRM")
  #7 {main}
  
  
  Jun 22 20:55:28  [error] $Fatal Error Details = Array
  (
      [callback] => Array
          (
              [0] => CRM_Core_Error
              [1] => exceptionHandler
          )
  
      [code] => -14
      [message] => DB Error: no database selected
      [mode] => 16
      [debug_info] => SELECT * 
   FROM   `civicrm_component`   
   
   
   
   
   
   [nativecode=2006 ** MySQL server has gone away]
      [type] => DB_Error
      [user_info] => SELECT * 
   FROM   `civicrm_component`   
   
   
   
   
   
   [nativecode=2006 ** MySQL server has gone away]
      [to_string] => [db_error: message="DB Error: no database selected" code=-14 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="SELECT * 
   FROM   `civicrm_component`   
   
   
   
   
   
   [nativecode=2006 ** MySQL server has gone away]"]
  )
  
  
  Jun 22 20:56:14  [debug] $backTrace = #0 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(954): CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::exceptionHandler(Object(DB_Error))
  #2 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB.php(997): PEAR_Error->__construct("DB Error: no database selected", -14, 16, (Array:2), "SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n [nativecode=2006 *...")
  #3 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-14, 16, (Array:2), "SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n [nativecode=2006 *...")
  #4 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR::_raiseError(Object(DB_mysqli), NULL, -14, 16, (Array:2), "SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n [nativecode=2006 *...", "DB_Error", TRUE)
  #5 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php(1928): PEAR->__call("raiseError", (Array:7))
  #6 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php(936): DB_common->raiseError(-14, NULL, NULL, "SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n [nativecode=2006 *...", "2006 ** MySQL server has gone away")
  #7 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php(391): DB_mysqli->mysqliRaiseError(-14)
  #8 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php(1234): DB_mysqli->simpleQuery("SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n")
  #9 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2696): DB_common->query("SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n")
  #10 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(451): DB_DataObject->_query("SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n")
  #11 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Component.php(74): DB_DataObject->find(FALSE)
  #12 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Component.php(37): CRM_Core_Component::getComponents()
  #13 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Component.php(116): CRM_Core_Component::_info(FALSE)
  #14 /var/www/html/wp-content/plugins/civicrm-admin-utilities/includes/civicrm-admin-utilities-single.php(2269): CRM_Core_Component::getEnabledComponents()
  #15 /var/www/html/wp-includes/class-wp-hook.php(307): CiviCRM_Admin_Utilities_Single->shortcuts_menu_add(Object(WP_Admin_Bar))
  #16 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, (Array:1))
  #17 /var/www/html/wp-includes/plugin.php(524): WP_Hook->do_action((Array:1))
  #18 /var/www/html/wp-includes/admin-bar.php(95): do_action_ref_array("admin_bar_menu", (Array:1))
  #19 /var/www/html/wp-includes/class-wp-hook.php(307): wp_admin_bar_render("")
  #20 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters("", (Array:1))
  #21 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action((Array:1))
  #22 /var/www/html/wp-admin/admin-header.php(267): do_action("in_admin_header")
  #23 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/Base.php(312): require_once("/var/www/html/wp-admin/admin-header.php")
  #24 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System.php(202): CRM_Utils_System_Base->theme("invoke("")
  #29 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters("", (Array:1))
  #30 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action((Array:1))
  #31 /var/www/html/wp-admin/admin.php(259): do_action("toplevel_page_CiviCRM")
  
  any ideas?
  
  **Tags:** upgrade, civicrm-home
  
  > **Comments:**
  > **username_0**: Here is the entire backtrace:  
  > **username_0**: Would really appreciated some suggestions, I have no idea what to do with this.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-06-23. Score: 0
  
  This indicates that MySQL has crashed. Check your MySQL log for details, and considering increasing the number of open connections.
  
  > **Comments:**
  > **username_0**: Thanks, I tried that, then I noticed this odd error in the MySQL logs:   [ERROR] /usr/sbin/mysqld: Out of memory (Needed 32 bytes) I certainly have 32 bytes free.  Have  been monitoring and plenty of free memory, no swapping happening.  
  > **username_1**: @DanJacobs That error indicates that MySQL wanted 32 bytes more than it had available.  Check `/etc/mysql/my.cnf` and files in `/etc/mysql/conf.d` for your MySQL settings (this is Debian/Ubuntu, not sure about other OSes/distros).  Is this an old server?  I see issues like this when I upgrade the OS but don't take the new default settings for MySQL and keep the old ones.  "Reasonable" defaults for memory allocation have changed over time - and it sounds like you can spare more RAM to MySQL.  
  > **username_0**: Thanks, Jon, I had already massively upped the defaults.  Didn't work.  
  > **username_0**: upgraded the server to 4gb RAM and changed innodb_buffer_pool_size to 3G.  Same problem.  
  > **username_0**: ok, after upgrading the RAM and doing some more tuning of MySQL, I got the same error but also an error saying a table was corrupt (wordpress.log_civicrm_msg_template).  I turned off logging and dropped the table.  Now the upgrade has started to run!  
  > **username_1**: @DanJacobs Very glad to hear it!  Note that "massively upping the defaults" is actually the *cause* rather than *solution* to MySQL issues - which you probably learned today. e.g. increasing the innodb_buffer_pool_size is good for performance, but if you let MySQL allocate more RAM than there is available, you get an out-of-memory error.  OOM errors generally require you lower the RAM allocations  
  
  ---
  
  