laravel 语法错误或访问冲突:1115 未知字符集:utf8mb4

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41835923/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 15:11:43  来源:igfitidea点击:

Syntax error or access violation: 1115 Unknown character set: utf8mb4

phplaravellaravel-5.3

提问by Alexu

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?

如何解决此错误?

回答by Ali Rasheed

Go to config/database.phpand replace these two lines with these

转到config/database.php并用这些替换这两行

'charset' => 'utf8','collation' => 'utf8_unicode_ci',

'charset' => 'utf8','collation' => 'utf8_unicode_ci',

回答by Umar Tariq

Go to config/database.php and replace these lines. That's it

转到 config/database.php 并替换这些行。就是这样

'charset' => 'utf8',  
'collation' => 'utf8_unicode_ci',