Open mahdirashidi opened 3 years ago
Hi, if you have created your database with utf8 general_ci collation, try this params :
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
in config/database.php
If not solved, try this solution https://blog.neversyn.com/how-to-fix-specified-key-was-too-long-issue/
php artisan world:init Execute migrate first, migrating... Migrating: 2017_04_08_163453_create_world_cities_locale_table Migrated: 2017_04_08_163453_create_world_cities_locale_table (80.40ms) Migrating: 2017_04_08_163453_create_world_cities_table
Illuminate\Database\QueryException
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table
world_cities
add indexuniq _city
(country_id
,division_id
,name
))at vendor\laravel\framework\src\Illuminate\Database\Connection.php:678 674▕ // If an exception occurs when attempting to run a query, we'll format the error 675▕ // message to include the bindings with SQL, which will make this exception a 676▕ // lot more helpful to the developer instead of just the database's errors. 677▕ catch (Exception $e) { ➜ 678▕ throw new QueryException( 679▕ $query, $this->prepareBindings($bindings), $e 680▕ ); 681▕ } 682▕
1) vendor\laravel\framework\src\Illuminate\Database\Connection.php:471 PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes")
2) vendor\laravel\framework\src\Illuminate\Database\Connection.php:471 PDOStatement::execute()