Eu estou usando o Symfony 4 e a versão Mysql é 8.0.11 e usando um usuário em vez de um login root e quando tento usar o comando php bin/console make:migration
Eu recebo este erro:
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
Então eu tentei pesquisar on-line e descobri que algo deu errado com as variáveis do MySQL wait_timeout
e max_allowed_packet
e tive que mudar essas variáveis no arquivo /etc/mysql/my.cnf
, o problema é quando eu vou editar esse arquivo eu só encontro isso:
# 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/
então eu tentei ver um fio chamado " Por que o /etc/mysql/my.cnf EMPTY? "e um usuário disse para usar um desses caminhos:
/etc/mysql/conf.d/
/etc/mysql/mysql.conf.d/
/etc/mysql/mysql.conf.d/mysqld.cnf
e então eu tentei ... /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]
no arquivo /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
e no arquivo /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
e em qualquer um desses arquivos eu não consegui encontrar as variáveis do MySQL wait_timeout
e max_allowed_packet
, obrigado antecipadamente se alguém pudesse me ajudar com este problema. :)
P.S: (eu já corri este comando php bin/console make:migration
várias vezes antes deste erro e também criou bancos de dados e correu bem, então parece não ser um problema de instalação).
Atualizar: parece mudou com sucesso as duas variáveis wait_timeout
e max_allowed_packet
globalmente, adicionando aos três arquivos os seguintes
max_allowed_packet=1024M
wait_timeout=3000000
e então usando este comando sudo service mysql restart
me dando isso:
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)
mas ainda quando eu tentei usar este comando php bin/console make:migration
deu-me o mesmo erro já mencionado acima deste post, também tentou mudar o wait_timeout
variável para 300 pelo mesmo método e me deu o mesmo resultado. :(
usando este comando sudo vim /var/log/mysql/error.log
Eu entendi isso:
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.
Atualizar: Eu desintalled o mysql e php e mudei para o mysql 5.7 e php 7.2.7, a alteração do php pode ter resolvido de acordo com ligação o usuário @jibe, se alguém ainda não consegue resolver o problema eu deixo esses dois outros links link 1 e link2 .
platforms:https://dev.mysql.com/doc/refman/8.0/en/gone-away.html
GeniusesOfSymfony/WebSocketBundle#299
Espero que eles te ajudem.