[英]Laravel-8:php artisan migrate not working
我尝试运行命令:php artisan migrate,但它给了我以下错误。
错误:
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=
我一次又一次地尝试 make migrate,所以只需查看文件 .env 并禁用注释 DB_HOST= mysql 并启用 DB_HOST=127.0.0.1 现在再次尝试放置终端 php artisan migrate 所以看起来一切正常!
php工匠配置:清除
试试这个
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.