I know this problem is discussed, and solved or closed.
But what I want to ask is, why is the number 191?
Schema::defaultStringLength(191);
I tried: if 192, wrong. 191, ok.
After this, I also edit database\migrations\xxx_user_table.php
Change this
$table->string('name');
to be
$table->string('name', 255);
Then run php artisan migrate, it's ok. Use some mysql tool to see the schema of user table, length of name which is varchar is actually 255, others columns are 191.
I saw these articles
@ https://laravel-news.com/laravel-5-4-key-too-long-error
@ Laravel migration: unique key is too long, even if specified
@ https://github.com/laravel/framework/issues/17508
@ https://laravel.com/docs/master/migrations#creating-indexes
And this: @ https://dev.mysql.com/doc/refman/5.7/en/innodb-restrictions.html
The index key prefix length limit is 767 bytes for InnoDB tables that use the REDUNDANT or COMPACT row format. For example, you might hit this limit with a column prefix index of more than 255 characters on a TEXT or VARCHAR column, assuming a utf8mb3 character set and the maximum of 3 bytes for each character.
But why length 255 of name is ok?
And 192*3 = 576, smaller than 767, why 192 not ok?