执行 PHP artisan migrate 为什么 MySQL 的连接 HOST 是 localhost?
在执行php artisan migrate
的时候报错:
SQLSTATE[42000]: Syntax error or access violation: 1142
CREATE command denied to user 'admin'@'localhost' for table 'migrations'
我的数据库配置都是127.0.0.1, 为什么这里连接到localhost,求解?????
.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
database.php
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
配置缓存也清了。
"laravel/framework": "5.5.*"
问题找到,不是laravel 的问题,是建数据库的时候用户授权有问题,但是这个错误绝对能误导,谨慎。