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
i 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 alterar essas variáveis no arquivo /etc/mysql/my.cnf
, o problema é quando eu vou editar esse arquivo Eu só acho 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 tópico chamado " Por que é / etc / mysql / my.cnf EMPTY? "e um usuário disse para usar um destes 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
, então obrigado antecipadamente se alguém pudesse me ajudar com este problema. :)
P.S: (eu já executei este comando php bin/console make:migration
várias vezes antes desse erro e também criei bancos de dados e correu bem, então parece que não é um problema de instalação).
Atualização: parece que as variáveis wait_timeout
e max_allowed_packet
foram alteradas globalmente, adicionando aos três arquivos os seguintes
max_allowed_packet=1024M
wait_timeout=3000000
e, em seguida, 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 tentei usar esse comando php bin/console make:migration
me deu o mesmo erro que mencionei acima neste post, também tentei alterar a variável wait_timeout
para 300 pelo mesmo método e me deu o mesmo resultado. : (
usando este comando sudo vim /var/log/mysql/error.log
i obter isto:
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.
Atualização:
Eu desintalled mysql e php e mudei para o mysql 5.7 e php 7.2.7, a mudança do php pode ter resolvido de acordo com link o usuário @jibe, se alguém ainda não conseguir resolver o problema eu deixo esses dois outros links
link 1
e link2 .