larvel 出現ONLY_FULL_GROUP_BY SQL提示

1:mysql5.7須要sql_mode的值爲:STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIONphp

2:修改config/databases.php中mysql的strictmysql

'mysql' => [
    'driver' => 'mysql',
    'host' => env('DB_HOST', ''),
    'port' => env('DB_PORT', ''),
    'database' => env('DB_DATABASE', ''),
    'username' => env('DB_USERNAME', ''),
    'password' => env('DB_PASSWORD', ''),
    'unix_socket' => env('DB_SOCKET', ''),
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
    'prefix' => env('DB_PREFIX','user_'),
    'strict' => false,
    'engine' => null,
],
相關文章
相關標籤/搜索