Laravel 5.5 Error Base table or view already exists: 1050 Table 'users' already exists

前端 未结 15 1294
温柔的废话
温柔的废话 2020-11-30 10:22

Specifications:

  • Laravel Version: 5.5.3
  • PHP Version: 7.1
  • Database Driver & Version: MariaDB 10.1.26

相关标签:
15条回答
  • 2020-11-30 11:16

    You can skip migrate the table if table exist in database by add this code:

    public function up()
    {
        if(Schema::hasTable('users')) return;       //add this line to your database file
    
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
    
        });
    }
    
    0 讨论(0)
  • Change your Mysql Engine Setting

    In config/database.php, change your mysql engine setting to: 'engine' => 'innodb row_format=dynamic'.

    Note: This is applicable to Laravel 5.2.14+

    0 讨论(0)
  • 2020-11-30 11:20

    There are two possible solutions for this as mentioned on this link:

    https://www.codespeaker.com/laravel-framework/solutions-for-common-errors-on-artisan-commands/

    First is rollback

    php artisan migrate:rollback

    Second is dropping of tables.

    0 讨论(0)
提交回复
热议问题