我已经设置好了我的laravel项目,配置了mysql用户名和密码,并创建了数据库。我已经设置好了迁移和种子。然而,当我运行php artisan migrate
时,我遇到了以下错误。
INFO Preparing database.
Creating migration table ............................................................................................................... 38ms DONE
INFO Loading stored database schemas.
database/schema/mysql-schema.sql ...................................................................................................... 115ms DONE
In Connection.php line 801:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db_name.migrations' doesn't exist (Connection: mysql, SQL: select `migration` from `migrations` order by `batch` asc, `migration` asc)
In Connection.php line 416:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db_name.migrations' doesn't exist
字符串
我尝试在MySQL中创建迁移表,
USE db_name; CREATE TABLE migrations ( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, migration VARCHAR(255) NOT NULL, batch INT NOT NULL ) ENGINE=InnoDB;
型
然后它返回Query OK, 0 rows affected (0.01 sec)
。然而,当我使用php artisan migrate
运行迁移时,我遇到了上面提到的相同错误,当我查看数据库时,迁移表不再存在。
问题可能是什么,我该如何解决它?
1条答案
按热度按时间qyuhtwio1#
试试这个:
字符串
来源:Laravel migration is not working and missing
migrations
table