mysql version 8.0.11 and Symfony 4 error “O servidor MySQL foi embora”


0

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 .


você já descobriu o que estava causando a mensagem "Unexpected server respose while doing caching_sha2"? Eu tenho isso hoje com o PHP 7.2.8 e 8.0.12. Obrigado.
ScottyB

Eu desinstalei a versão mySQL versão 8 e instalei o 5.7 e o problema foi resolvido, mas eu tenho esses links que eu encontrei em outros platforms:https://dev.mysql.com/doc/refman/8.0/en/gone-away.html GeniusesOfSymfony/WebSocketBundle#299Espero que eles te ajudem.
Alexandre Pereira

Respostas:


1

Eu sei que já faz um tempo, mas encontrei a resposta. Use o seguinte comando para atualizar sua senha com o novo plugin de autenticação. Você pode usar o MySQL 8 agora. Diverta-se.

ALTER USER `username`@`localhost` IDENTIFIED WITH caching_sha2_password BY 'password';

OU

ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Obrigado pela resposta: D, eu ainda estou usando o MySQL 5.7 e eu não tive mais problemas desde então, mas se eu usar o MySQL 8 eu vou tentar a sua solução.
Alexandre Pereira
Ao utilizar nosso site, você reconhece que leu e compreendeu nossa Política de Cookies e nossa Política de Privacidade.
Licensed under cc by-sa 3.0 with attribution required.