关于 MySQL8 的一点小问题?

刚从MySQL5.7换到MySQL8了

在Laravel里面用MySQL 8
出现了一个sql_mode不能设置为 NO_AUTO_CREATE_USER的错误

image

原因不详

先在Mysql的配置文件里面的sql_mode加上NO_AUTO_CREATE_USER 并去掉了STRICT_TRANS_TABLES

但是只要加上了NO_AUTO_CREATE_USER这个选项之后, MySQL就启动不了

也没有错误给出

百度一番无果

最后直接修改database.php里面的MySQL的严格模式为false

问题解决

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

是MySQL8 已经去掉了NO_AUTO_CREATE_USER这个选项嘛?

《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
最佳答案

MySQL 5.7: Using GRANT to create users. Instead, use CREATE USER. Following this practice makes the NO_AUTO_CREATE_USER SQL mode immaterial for GRANT statements, so it too is deprecated.
MySQL 8.0.11: Using GRANT to create users. Instead, use CREATE USER. Following this practice makes the NO_AUTO_CREATE_USER SQL mode immaterial for GRANT statements, so it too is removed.

如你所料,8.0.11中 删除了这个模式!

5年前 评论
讨论数量: 1

MySQL 5.7: Using GRANT to create users. Instead, use CREATE USER. Following this practice makes the NO_AUTO_CREATE_USER SQL mode immaterial for GRANT statements, so it too is deprecated.
MySQL 8.0.11: Using GRANT to create users. Instead, use CREATE USER. Following this practice makes the NO_AUTO_CREATE_USER SQL mode immaterial for GRANT statements, so it too is removed.

如你所料,8.0.11中 删除了这个模式!

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!