다음과 같은 오류가 발생합니다 (user 테이블이 아니라면 failed_jobs 또는 reset_password 테이블입니다. 대부분의 문제는 laravel 자동 생성 테이블에서 발생합니다. 그리고 예, PHP artisan migrate : reset을 시도했습니다. , localhost에서 테이블을 삭제하고 데이터베이스 자체도 삭제했습니다.)
Migrating: 2014_10_12_100000_create_password_resets_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 `password_resets` add index `password_resets_email_index`(`email`))
at C:\xampp\htdocs\project1\project\seed\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {
> 671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|
1 C:\xampp\htdocs\project1\project\seed\vendor\laravel\framework\src\Illuminate\Database\Connection.php:464
PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes")
2 C:\xampp\htdocs\project1\project\seed\vendor\laravel\framework\src\Illuminate\Database\Connection.php:464
PDOStatement::execute()
그리고 이것이 지금까지 database / migration / create_reset_password_table의 모습입니다.
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}
모든 도움에 미리 감사드립니다! :)
Laravel 기본 데이터 정렬 유형이 utf8mb4로 변경되었습니다.
당신의
AppServiceProvider.php
부팅 방법 다음 줄
use Illuminate\Support\Facades\Schema;
public function boot()
{
Schema::defaultStringLength(191);
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다