如何解决Laravel-8:PHP Artisan迁移不起作用
我尝试运行命令:PHP artisan migration,但这给了我下面的错误。
错误:
Illuminate\Database\QueryException
sqlSTATE[HY000]: General error: 1449 The user specified as a definer ('MysqL.infoschema'@'localhost') does not exist (sql: select * from information_schema.tables where table_schema = test and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.PHP:671
667▕ // If an exception occurs when attempting to run a query,we'll format the error
668▕ // message to include the bindings with sql,which will make this exception a
669▕ // lot more helpful to the developer instead of just the database's errors.
670▕ catch (Exception $e) {
➜ 671▕ throw new QueryException(
672▕ $query,$this->prepareBindings($bindings),$e
673▕ );
674▕ }
675▕
我也在Mac上使用Sequel Pro创建了一个数据库,但是当我创建数据库时,我不确定它是否已经按照预期的方式创建。
其设置为:
host id: 127.0.0.1
username: root
.env中的设置为:
DB_CONNECTION=MysqL
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=
解决方法
我试图一次又一次地进行迁移 因此只需查看文件.env并禁用注释DB_HOST = mysql并启用DB_HOST = 127.0.0.1 现在再次尝试将终端php artisan迁移,以便一切正常!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。