简体   繁体   English

Illuminate\Database\QueryException:SQLSTATE[HY000]:一般错误:1813 Tablespace for table

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

Am using Laravel 5.6我正在使用 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 .一般错误:1813 表“ jshop ”的表空间。 purchases ' exists. purchases ' 存在。 Please DISCARD the tablespace before IMPORT.请在 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.转到mysql/data/database_name /tablename.ibd file并手动删除它。 after this try your command php artisan migrate在此之后尝试你的命令php artisan migrate

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

Locate where your database is and delete the table.找到您的数据库所在的位置并删除该表。 Then run PHP artisan migrate This worked for me然后运行​​PHP artisan migrate这对我有用

Your database is corrupted, do the followinf steps to fix it.您的数据库已损坏,请执行以下步骤来修复它。

SETP 1. Drop the database and create a new one. SETP 1. 删除数据库并创建一个新的。

SETP 1. run the following command SETP 1.运行以下命令

php artisan migrate:refresh

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Docker Laravel 迁移错误 Illuminate\Database\QueryException SQLSTATE[HY000] - Docker Laravel migration error Illuminate\Database\QueryException SQLSTATE[HY000] Laravel 6-MariaDB 10.1:Illuminate \\ Database \\ QueryException:SQLSTATE [HY000]迁移错误 - Laravel 6 - MariaDB 10.1: Illuminate\Database\QueryException : SQLSTATE[HY000] migration error php artisan migrate - 错误 - Illuminate\Database\QueryException: SQLSTATE[HY000] [2054] - php artisan migrate - Error - Illuminate\Database\QueryException : SQLSTATE[HY000] [2054] Illuminate\\Database\\QueryException :SQLSTATE[HY000]:一般错误:1364 字段“user_id”没有默认值(SQL:插入“users” - Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value (SQL: insert into `users` Illuminate\Database\QueryException: SQLSTATE[HY000] [2002] 在文件 Illuminate/Database/Connection.php 上的第 678 行 - Illuminate\Database\QueryException: SQLSTATE[HY000] [2002] in file Illuminate/Database/Connection.php on line 678 php artisan migrate Illuminate\\Database\\QueryException SQLSTATE[HY000] [2054] 上的异常 - Exception on php artisan migrate Illuminate\Database\QueryException SQLSTATE[HY000] [2054] Illuminate \\ Database \\ QueryException (2002) SQLSTATE[HY000] [2002] 没有这样的文件或目录 (SQL: select * from `rents`) - Illuminate \ Database \ QueryException (2002) SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from `rents`) 如何修复“Illuminate\\Database\\QueryException: SQLSTATE[HY000] [1044] Access denied for user” - How to fix “Illuminate\Database\QueryException: SQLSTATE[HY000] [1044] Access denied for user” Illuminate\Database\QueryException: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (使用密码: YES) - Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) 更新表格错误? (SQLSTATE [HY000]:一般错误) - Updating table error? (SQLSTATE[HY000]: General error)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM