Definindo Variáveis Globais para o Mysql no Ubuntu 17

1

Estou tentando definir algumas variáveis globais e definir uma sessão para que um software de correspondência do assinante funcione corretamente. Mas quando tento definir essas variáveis no arquivo my.cnf e reiniciar o servidor mysql , recebo esse erro,

Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.

Abaixo está o arquivo my.cnf

# Copyright (c) 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 as published by
# the Free Software Foundation; version 2 of the License.
#
# 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 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

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

mysql> SET GLOBAL sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

mysql> SET SESSION sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
    
por D.T 20.10.2017 / 17:25

1 resposta

0

Primeiramente, parece que você tem alguns problemas de copiar e colar acontecendo. O mysql> é o prompt do cliente do console, portanto, isso nunca deve estar em nenhum arquivo de configuração.

Em segundo lugar, ao definir variáveis no arquivo de configuração , eles apenas se enquadram nos respectivos [section] cabeçalhos um por linha e os valores de chave são separados por um sinal igual a = .

Então, em /etc/mysql/mysql.conf.d/mysqld.cnf em qualquer lugar abaixo de [mysqld] add:

sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
    
por Jeff Puckett 20.11.2017 / 22:35