Magento 2 – Fix MySQL Server Has Gone Away Error

databasemagento2reindex

I managed to migrate magento 1 to new magento 2.2.5
When I reindex for the first time I get in indexer

Category Products

[2019-02-07 21:58:57] main.CRITICAL: Warning: PDOStatement::execute(): MySQL server has gone away in /var/www/html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228 {"exception":"[object] (Exception(code: 0): Warning: PDOStatement::execute(): MySQL server has gone away in /var/www/html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []

mysql.conf settings are:

[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = localhost
#
# * Fine Tuning
#
key_buffer_size         = 512M
max_allowed_packet      = 1024M
thread_stack            = 192K
thread_cache_size       = 256
connect_timeout=320 # default 10
table_open_cache = 4096
table_definition_cache  = 4096
sort_buffer_size        = 16M
max_heap_table_size     = 512M
tmp_table_size          = 512M
interactive_timeout     = 3600
max_connections         = 400
max_connect_errors      = 1000000
skip_name_resolve
#skip_secure_auth
wait_timeout            = 28800
innodb_buffer_pool_size = 2G
myisam_sort_buffer_size = 128M
innodb_log_file_size    = 256M
innodb_thread_concurrency  = 18
innodb_flush_log_at_trx_commit       = 2
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options  = BACKUP
#max_connections        = 100
#table_open_cache       = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 64M
query_cache_type        = 1

Tried to increase the limits in mysql with no luck.
Any suggestions please?

Best Answer

I managed to solved this. Problem was not really on mysql. Problem was because of wrong in the migration process. Although I got no errors there. This migration was the uber migration tool.

When did the process from start with magento native migration tool mysql and indexers are fine. Everything is working now