LoginSignup
19
7

More than 5 years have passed since last update.

Laravel5 MySQL8.0 NO_AUTO_CREATE_USERのSQL_MODEエラー対策

Last updated at Posted at 2018-05-29

前回に引き続き、MySQL8.0の罠がありました。

エラー

$ php artisan migrate
In Connection.php line 664:

  SQLSTATE[42000]: Syntax error or access violation: 1231 Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER' (SQL: sel
  ect * from information_schema.tables where table_schema = microposts and table_name = migrations)


In MySqlConnector.php line 150:

  SQLSTATE[42000]: Syntax error or access violation: 1231 Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'

対策

config/database.php

        'mysql' => [
            'strict' => false,
        ],

strict を false に変更すればokです。
新しくLaravelインストールしたものはデフォルトでfalseになってる(?)っぽいです。
以前から使ってるLaravelでMySQL8.0にバージョンアップしたときにエラーになりそうです。

参考

19
7
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
7