Pregunta mysql versión 8.0.11 y error Symfony 4 "El servidor MySQL se ha ido"


Estoy usando Symfony 4 y la versión de Mysql es 8.0.11 y el uso de un usuario en lugar de un inicio de sesión raíz y cuando trato de usar el comando php bin/console make:migration me sale este error:

In AbstractMySQLDriver.php line 126:                                                                                 
An exception occurred in driver: SQLSTATE[HY000] [2006] MySQL server has gone away                                                                                

In PDOConnection.php line 50:                                           
SQLSTATE[HY000] [2006] MySQL server has gone away  

In PDOConnection.php line 46:                                                
SQLSTATE[HY000] [2006] MySQL server has gone away  

In PDOConnection.php line 46: 
PDO::__construct(): Unexpected server respose while doing caching_sha2 auth: 109  

Luego traté de buscar en línea y descubrí que algo iba mal con las variables de MySQL wait_timeout y max_allowed_packet y tuvo que cambiar esas variables en el archivo /etc/mysql/my.cnf, el problema es que cuando edito ese archivo solo encuentro esto:

# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation.  The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
#
# The MySQL  Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

entonces intenté ver un hilo llamado "¿Por qué está /etc/mysql/my.cnf VACÍO?"y un usuario dijo usar una de estas rutas:

/etc/mysql/conf.d/
/etc/mysql/mysql.conf.d/
/etc/mysql/mysql.conf.d/mysqld.cnf

y así lo intenté ... /etc/mysql/conf.d/:

## Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation.  The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA

#
# The MySQL  Client configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysql]

en el archivo /etc/mysql/mysql.conf.d/:

# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation.  The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA

#
# The MySQL  Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
log-error       = /var/log/mysql/error.log

y en el archivo /etc/mysql/mysql.conf.d/mysqld.cnf:

# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation.  The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA

#
# The MySQL  Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
log-error       = /var/log/mysql/error.log

y en cualquiera de estos archivos no pude encontrar las variables de MySQL wait_timeout y max_allowed_packet, así que gracias de antemano si alguien podría ayudarme con este problema. :)

P.S: (ya ejecuté este comando php bin/console make:migration varias veces antes de este error y también creó bases de datos y fue bien, así que parece que no es un problema de instalación).

Actualizar: parece que cambió con éxito las dos variables wait_timeout y max_allowed_packet globalmente al agregar a los tres archivos lo siguiente

max_allowed_packet=1024M 
wait_timeout=3000000

y luego usando este comando sudo service mysql restart
dándome esto:

mysql> SHOW global VARIABLES LIKE "wait_timeout";
+---------------+---------+
| Variable_name | Value   |
+---------------+---------+
| wait_timeout  | 3000000 |
+---------------+---------+
1 row in set (0,00 sec)

mysql> SHOW VARIABLES like 'max_allowed_packet';
+--------------------+------------+
| Variable_name      | Value      |
+--------------------+------------+
| max_allowed_packet | 1073741824 |
+--------------------+------------+
1 row in set (0,00 sec)

pero aun así cuando intenté usar este comando php bin/console make:migration me dio el mismo error que he mencionado anteriormente en esta publicación, también intenté cambiar wait_timeout variable a 300 por el mismo método y me dio el mismo resultado. :(

usando este comando sudo vim /var/log/mysql/error.log entiendo esto:

2018-07-29T18:55:18.382164Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 8  user: 'alexandre'.
2018-07-29T18:55:20.288756Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.11)  MySQL Community Server - GPL.
2018-07-29T18:55:20.642118Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.11) starting as process 31833
2018-07-29T18:55:21.704556Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2018-07-29T18:55:21.720385Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.11'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.

Actualizar: Desintexté mysql y php y cambié a mysql 5.7 y php 7.2.7, el cambio php podría haberlo resuelto de acuerdo a enlazar  el usuario @jibe, si alguien aún no puede resolver el problema dejo estos otros dos enlaces enlace 1   y link2.


0


origen


¿Alguna vez descubrió qué estaba causando el mensaje "Reposo inesperado del servidor al hacer caching_sha2"? Hoy recibí esto con PHP 7.2.8 y 8.0.12. Gracias. - ScottyB
Desinstalé la versión mySQL versión 8 e instalé 5.7 y el problema se solucionó, pero tengo estos enlaces que encontré en otra platforms:https://dev.mysql.com/doc/refman/8.0/en/gone-away.html  GeniusesOfSymfony/WebSocketBundle#299, espero que te ayuden - Alexandre Pereira


Respuestas: