0

This question already has an answer here:

After entering some custom fields, I went to /content and now I am getting the following error:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away.

I've tried the following with no success:

  • Cleared cache (via drush)
  • Rebuilt Docker Container with increase in PHP config’s max_allowed_packet (recommended by several posts online).
  • Restart container/docker.

If I connect to another database, I don't see the error. Database connection was fine, this error happened after making changes to fields in Drupal Admin UI. The other answers seem to be for issues connecting to SQL, I have no such issues. Just specefic to the contents of a single database.

Here is the complete error:

Additional uncaught exception thrown while handling exception. Original

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: CREATE TABLE {cache_default} ( cid VARCHAR(255) BINARY CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT 'Primary Key: Unique cache ID.', data LONGBLOB NULL DEFAULT NULL COMMENT 'A collection of data to cache.', expire INT NOT NULL DEFAULT 0 COMMENT 'A Unix timestamp indicating when the cache entry should expire, or -1 for never.', created DECIMAL(14, 3) NOT NULL DEFAULT 0 COMMENT 'A timestamp with millisecond precision indicating when the cache entry was created.', serialized SMALLINT NOT NULL DEFAULT 0 COMMENT 'A flag to indicate whether content is serialized (1) or not (0).', tags LONGTEXT NULL DEFAULT NULL COMMENT 'Space-separated list of cache tags for this entry.', checksum VARCHAR(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL COMMENT 'The tag invalidation checksum when this entry was saved.', PRIMARY KEY (cid), INDEX expire (expire), INDEX created (created) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT 'Storage for the cache API.'; Array ( ) in Drupal\views\ViewsData->cacheSet() (line 211 of /var/www/html/core/modules/views/src/ViewsData.php).

Drupal\views\ViewsData->cacheSet('views_data', Array) (Line: 259) Drupal\views\ViewsData->getData() (Line: 162) Drupal\views\ViewsData->get('block_content') (Line: 91) Drupal\views\Plugin\Derivative\ViewsEntityRow->getDerivativeDefinitions(Array) (Line: 101) Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array) (Line: 87) Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions() (Line: 284) Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 175) Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 147) views_theme(Array, 'module', 'views', 'core/modules/views') (Line: 447) Drupal\Core\Theme\Registry->processExtension(Array, 'views', 'module', 'views', 'core/modules/views') (Line: 334) Drupal\Core\Theme\Registry->build() (Line: 233) Drupal\Core\Theme\Registry->get() (Line: 86) Drupal\Core\Utility\ThemeRegistry->initializeRegistry() (Line: 67) Drupal\Core\Utility\ThemeRegistry->__construct('theme_registry:runtime:seven', Object, Object, Array, 1) (Line: 253) Drupal\Core\Theme\Registry->getRuntime() (Line: 142) Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 437) Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 195) Drupal\Core\Render\Renderer->render(Array, 1) (Line: 139) Drupal\Core\Render\Renderer->Drupal\Core\Render{closure}() (Line: 582) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 140) Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 66) Drupal\Core\Render\BareHtmlPageRenderer->renderBarePage(Array, Object, 'install_page', Array) (Line: 76) Drupal\Core\ProxyClass\Render\BareHtmlPageRenderer->renderBarePage(Array, Object, 'install_page', Array) (Line: 1005) install_display_output(Array, Array) (Line: 156) install_drupal(Object) (Line: 44)

Additional

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: CREATE TABLE {cache_default} ( cid VARCHAR(255) BINARY CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT 'Primary Key: Unique cache ID.', data LONGBLOB NULL DEFAULT NULL COMMENT 'A collection of data to cache.', expire INT NOT NULL DEFAULT 0 COMMENT 'A Unix timestamp indicating when the cache entry should expire, or -1 for never.', created DECIMAL(14, 3) NOT NULL DEFAULT 0 COMMENT 'A timestamp with millisecond precision indicating when the cache entry was created.', serialized SMALLINT NOT NULL DEFAULT 0 COMMENT 'A flag to indicate whether content is serialized (1) or not (0).', tags LONGTEXT NULL DEFAULT NULL COMMENT 'Space-separated list of cache tags for this entry.', checksum VARCHAR(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL COMMENT 'The tag invalidation checksum when this entry was saved.', PRIMARY KEY (cid), INDEX expire (expire), INDEX created (created) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT 'Storage for the cache API.'; Array ( ) in Drupal\views\ViewsData->cacheSet() (line 211 of /var/www/html/core/modules/views/src/ViewsData.php).

Drupal\views\ViewsData->cacheSet('views_data:block_content', Array) (Line: 178) Drupal\views\ViewsData->get('block_content') (Line: 91) Drupal\views\Plugin\Derivative\ViewsEntityRow->getDerivativeDefinitions(Array) (Line: 101) Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array) (Line: 87) Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions() (Line: 284) Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 175) Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 147) views_theme(Array, 'module', 'views', 'core/modules/views') (Line: 447) Drupal\Core\Theme\Registry->processExtension(Array, 'views', 'module', 'views', 'core/modules/views') (Line: 334) Drupal\Core\Theme\Registry->build() (Line: 233) Drupal\Core\Theme\Registry->get() (Line: 86) Drupal\Core\Utility\ThemeRegistry->initializeRegistry() (Line: 67) Drupal\Core\Utility\ThemeRegistry->__construct('theme_registry:runtime:seven', Object, Object, Array, 1) (Line: 253) Drupal\Core\Theme\Registry->getRuntime() (Line: 142) Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 437) Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 195) Drupal\Core\Render\Renderer->render(Array, 1) (Line: 139) Drupal\Core\Render\Renderer->Drupal\Core\Render{closure}() (Line: 582) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 140) Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 66) Drupal\Core\Render\BareHtmlPageRenderer->renderBarePage(Array, 'Error', 'install_page', Array) (Line: 76) Drupal\Core\ProxyClass\Render\BareHtmlPageRenderer->renderBarePage(Array, 'Error', 'install_page', Array) (Line: 1005) install_display_output(Array, Array, Array) (Line: 260) _drupal_log_error(Array, 1) (Line: 600) _drupal_exception_handler(Object)

marked as duplicate by Clive 8 Dec 4 '18 at 8:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I think MySQL server has gone away mean that your Mysql server not running, did you try drush sql-cli to check if you can connect to mysql . – berramou Dec 3 '18 at 16:29
  • @berramou drush sql-cli connects and if I swap databases (by changing name in settings.php) it works, so it is connecting. – Sam Dec 3 '18 at 16:55
  • You added the create table information... does the SQL user you are connecting with have the rights to create tables? You can also test this by trying to create a temporary table using the drush sql-cli command line (just a wrapper for mysql that uses drupal id/password). You might also check the mysql logs for more error info. – CG Monroe Dec 3 '18 at 19:05
0

See this question:

Database general error: 2006 MySQL server has gone away

Basically, you need to increase the MySQL max_allowed_packet setting. There is an option as well to compress cached data if you can't.

http://drupal.org/node/1281408

  • I increased max_allowed_packet but it had no effect. – Sam Dec 3 '18 at 16:56
  • I examined my SQL and found: Aborted connection 11 to db: (Got a packet bigger than 'max_allowed_packet' bytes) I believe I need to increase max_allowed_packet in my SQL not my PHP. – Sam Dec 4 '18 at 3:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.