[Laravel] Laravel 出現 SQLSTATE[42000] Syntax error or access violation 解法
今天使用MySQL出現SQLSTATE[42000]: Syntax error or access violation,這是因為SQL_MODE的限制,修正方式如下:
找到config/database.php,並將 strict 改成False 就可以了
'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', 'localhost'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'engine' => null, ]
留言
張貼留言