Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ucan-lab opened this issue May 29, 2018 · 9 comments
Closed
Assignees

Comments

@ucan-lab
Copy link
Owner

ucan-lab commented May 29, 2018

エラー

$ 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'
@ucan-lab ucan-lab self-assigned this May 29, 2018
@ucan-lab
Copy link
Owner Author

対策

config/database.php

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

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

参考

@ucan-lab
Copy link
Owner Author

@Apollo725
Copy link

Great, https://laracasts.com/discuss/channels/laravel/help-about-mysql-80-problem
This can solve my problem, Thanks.

@sopedro
Copy link

sopedro commented Mar 25, 2019

Great @ucan-lab . It solves my problem too. Many thanks.

@AungPhyoKywe
Copy link

AungPhyoKywe commented Dec 27, 2019

I change in databases.php
'mysql' => [

        'strict' => false,
    
    ],

@thaifani
Copy link

change
,
'strict' => false ,

@wincodes
Copy link

wincodes commented Jul 19, 2020

Thanks guys

'strict' => false

Worked for me

@osamasado
Copy link

@wincodes I have the same issue with drupal project, but I do not know where to find this file databases.php, can you help me please?

@gideonp
Copy link

gideonp commented Jul 28, 2021

Dōmo arigatō ucan rabo

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants