刚刚创建了一个新的 laravel 项目并尝试迁移表,我得到了这个:
SQLSTATE[HY000] [2002] 没有这样的文件或目录(SQL:select * from information_schema.tables where table_schema = SugarDaddy and table_name = migrations and table_type = 'BASE TABLE')
我尝试清除缓存、路由、配置,并将 DBHOST 从 127.0.0.1 更改为 localhost,然后再更改回来,正如我在几篇相关文章中看到的那样,但没有任何效果。我将把迁移和 ss 留在数据库中。
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/ …Run Code Online (Sandbox Code Playgroud)