Check your encoding, is it utf8mb4. I am set at utf8mb4_0900_ai_ci.
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (Connection: mysql, SQL: alter table `users` add unique `users_email_unique`(`email`))
Hello friends, when I try to install Laravel 12 project, every time i get this issue. what is the permanent solution for this.
rohitjangir@DESKTOP-BP29VVL MINGW64 /c/wamp64/www/test-project $ php artisan migrate:fresh
Dropping all tables ................................................................................................................. 75.40ms DONE
INFO Preparing database.
Creating migration table ............................................................................................................ 21.85ms DONE
INFO Running migrations.
0001_01_01_000000_create_users_table ................................................................................................ 33.44ms FAIL
Illuminate\Database\QueryException
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (Connection: mysql, SQL: alter table users add unique users_email_unique(email))
at vendor\laravel\framework\src\Illuminate\Database\Connection.php:822 818▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 819▕ ); 820▕ } 821▕ ➜ 822▕ throw new QueryException( 823▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 824▕ ); 825▕ } 826▕ }
1 vendor\laravel\framework\src\Illuminate\Database\Connection.php:568 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:568 PDOStatement::execute()
rohitjangir@DESKTOP-BP29VVL MINGW64 /c/wamp64/www/test-project
Please or to participate in this conversation.