Php 无法使用MYSQL8迁移Laravel中的表

Php 无法使用MYSQL8迁移Laravel中的表,php,mysql,laravel,Php,Mysql,Laravel,我使用的是Ubuntu20.04(刚刚升级),它将我的mysql版本从5.7.30改为8.0.20。我创建了一些迁移,但当我使用artisan运行它们时,它们失败了。然后我尝试执行php-artisan-migrate:fresh,它删除了我所有的表,但迁移没有完成。是否有人知道Ubuntu将我的MySQL版本升级到8+确实是这个问题的原因?其他一切都没有改变。我的数据库凭证在我的.env等中是金色的。。。在错误本身中,idk为什么试图创建一个名为migration的表 错误: php arti

我使用的是Ubuntu20.04(刚刚升级),它将我的mysql版本从5.7.30改为8.0.20。我创建了一些迁移,但当我使用artisan运行它们时,它们失败了。然后我尝试执行
php-artisan-migrate:fresh
,它删除了我所有的表,但迁移没有完成。是否有人知道Ubuntu将我的MySQL版本升级到8+确实是这个问题的原因?其他一切都没有改变。我的数据库凭证在我的.env等中是金色的。。。在错误本身中,idk为什么试图创建一个名为
migration
的表

错误:

php artisan迁移:新鲜

Dropped all tables successfully.

   Illuminate\Database\QueryException  : SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null' at line 1 (SQL: create table `migrations` (`id` int unsigned not null auto_increment primary key, `migration` varchar(255) not null, `batch` int not null) default character set utf8 collate 'utf8_unicode_ci' engine = null)

  at /home/projects/inquiry-app/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
    665|         // If an exception occurs when attempting to run a query, we'll format the error
    666|         // message to include the bindings with SQL, which will make this exception a
    667|         // lot more helpful to the developer instead of just the database's errors.
    668|         catch (Exception $e) {
  > 669|             throw new QueryException(
    670|                 $query, $this->prepareBindings($bindings), $e
    671|             );
    672|         }
    673| 

  Exception trace:

  1   Doctrine\DBAL\Driver\PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null' at line 1")
      /home/projects/inquiry-app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:63

  2   PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null' at line 1")
      /home/projects/inquiry-app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:61

  Please use the argument -v to see more details.
迁移一:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateQuestionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('questions', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title');
            $table->string('slug')->unique();
            $table->text('body');
            $table->unsignedBigInteger('views')->default(0);
            $table->unsignedBigInteger('answers')->default(0);
            $table->integer('votes')->default(0);
            $table->unsignedBigInteger('best_answer_id')->nullable();
            //Foreign Key
            $table->unsignedBigInteger('user_id');
            $table->timestamps();

            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('questions');
    }
}

转到
config/database.php
并更改:

'engine' => null,
致:

或者在每次迁移时手动定义引擎:

$table->engine('InnoDB');

是的,这就是问题所在,谢谢。我还必须运行composer dumpautoload
'engine' => 'InnoDB'
$table->engine('InnoDB');