- Get link
- X
- Other Apps
laravel php artisan migrate Migrating: 2014_10_12_000000_create_users_table Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))
Sanjay Tech solutions
php artisan migrate
Migrating: 2014_10_12_000000_create_users_table
Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))
php artisan migrate
Migrating: 2014_10_12_000000_create_users_table
Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))
this probles with database drive provider
i have resolved error with 3 solution
solution 1
you need to create database with type " utf8_unicode_ci "
solution 2
change in config/database.php file
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
to
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
solution 3
Add following code to your project file AppServiceProvider.php (/app/Providers/AppServiceProvider.php)
use Illuminate\Support\Facades\Schema; //NEW: Import Schema
function boot()
{
Schema::defaultStringLength(191); //NEW: Increase StringLength
}
Comments
Post a Comment