简体   繁体   中英

Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1813 Tablespace for table

Am using Laravel 5.6

I Tried to migrate purchases table for my project
When i tried to migrate and it's showing Table Space error.

General error: 1813 Tablespace for table ' jshop . purchases ' exists. Please DISCARD the tablespace before IMPORT.

Migrate Code Below :

Schema::create('purchases', function (Blueprint $table) {
        $table->increments('id');
        $table->integer("product_price");
        $table->integer("product_qty");
        $table->unsignedInteger('invoice_id');
        $table->unsignedInteger('product_id');
        $table->unsignedInteger('weight_id');
        $table->timestamps();
        $table->foreign("invoice_id")->references('id')->on('invoices');
        $table->foreign("product_id")->references('id')->on('products');
        $table->foreign("weight_id")->references('id')->on('weights');
    });

invoice,products,weights table are valid in my database.

Error Message Image Below : Migration Error image Link How to solve this ?

Full Migration Code Image

try this:

php artisan migrate:refresh

if it is not solve this error try this:

Go to mysql/data/database_name /tablename.ibd file and delete it manually. after this try your command php artisan migrate

删除数据库并创建一个新的。

Locate where your database is and delete the table. Then run PHP artisan migrate This worked for me

Your database is corrupted, do the followinf steps to fix it.

SETP 1. Drop the database and create a new one.

SETP 1. run the following command

php artisan migrate:refresh

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM