[英]Syntax error or access violation: 1115 Unknown character set: utf8mb4
I am migrating my classes but I am getting this error in laravel.我正在迁移我的课程,但我在 laravel 中收到此错误。
[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1115 Unknown character set: 'utf8mb4'
[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1115 Unknown character set: 'utf8mb4'
How do I resolve this error?我该如何解决这个错误?
Go to config/database.php
and replace these two lines with these转到config/database.php
并将这两行替换为这些
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
Go to config/database.php and replace these lines.转到 config/database.php 并替换这些行。 That's it就是这样
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
This can be fixed in two ways:这可以通过两种方式修复:
1st - edit your .env file第一 - 编辑你的 .env 文件
DB_CHARSET=utf8
DB_COLLATION=utf8_unicode_ci
2nd - If you don't use env-file just edit config/database.php第二 - 如果你不使用 env-file 只需编辑 config/database.php
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
Will work for Lumen/Laravel将适用于 Lumen/Laravel
Edit your config/database.php file编辑你的 config/database.php 文件
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
run -> php artisan config:clear
运行 -> php artisan config:clear
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.