码迷,mamicode.com
首页 > 其他好文 > 详细

解决Laravel错误1071 Specified key was too long的多种方法

时间:2020-04-24 09:11:06      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:ati   def   mil   ica   webkit   setting   UNC   instead   charset   

If you are using MariaDB or an older version of MySQL, you need to place this code in your AppServiceProvider.php:

use Illuminate\Support\Facades\Schema;  public function boot() {     Schema::defaultStringLength(191); } 

Inside config/database.php, replace this line for mysql

‘engine‘ => null‘, 

with

‘engine‘ => ‘InnoDB ROW_FORMAT=DYNAMIC‘, 

Instead of setting a limit on your string lenght.Change  database.php which is in config folder where it says

‘charset‘ => ‘utf8mb4‘, ‘collation‘ => ‘utf8mb4_unicode_ci‘, 

I changed these to

‘charset‘ => ‘utf8‘, ‘collation‘ => ‘utf8_unicode_ci‘,

 

解决Laravel错误1071 Specified key was too long的多种方法

标签:ati   def   mil   ica   webkit   setting   UNC   instead   charset   

原文地址:https://www.cnblogs.com/linzenews/p/12764939.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!