Drupal - Syntax error or access violation - 1231 Variable sql mode can't be set to the value of

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2023
Перейти к:навигация, поиск

Drupal - Syntax error or access violation - 1231 Variable sql mode can't be set to the value of

Ошибка при переносе сайта с mysql 5.7.x на mysql 8.x:

Error
The website encountered an unexpected error. Please try again later.
Error messagePDOException: SQLSTATE[42000]: Syntax error or access violation: 1231 Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER' in lock_may_be_available() (line 167 of /home/user1/domains/site.ru/includes/lock.inc).

Решение - пофиксить файл sites/default/settings.php

$databases = array (
 'default' =>
 array (
   'default' =>
   array (
     'database' => 'db_name',
     'username' => 'user_name',
     'password' => 'pass1111',
     'host' => 'localhost',
     'port' => ,
     'driver' => 'mysql',
     'prefix' => 'dp_',
     'init_commands' => array(
     'sql_mode' => "SET sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO'",
     )
   ),
 ),
);