【发布时间】:2019-02-27 12:07:11
【问题描述】:
The first picture is the database config in .env file and the port number is 3306
The second picture is the database config in /config/database.php file
The third picture is the database config in mysql workbench
.env文件中端口号设置为3306时无法迁移模型和访问数据库,设置为33060则可以访问。
它生成错误“Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations)”当我尝试运行“php artisan migrate”时。
我尝试了很多方法,但在使用端口 3306 时仍然遇到同样的问题。
【问题讨论】:
-
您必须将
DB_HOST设置为您可以访问vagran 框的IP 地址,检查您的vagrantfileip_address设置为哪个值 -
我搜索了项目目录,找到了三个vagrantfile,但没有一个包含“ip_address”。
-
可以通过终端访问vagrant box吗?
-
是的,我可以在终端中使用 vagrant 命令,例如“vagrant up”。
-
输入你的 vagrantfile
config.vm.network "public_network", ip: "192.168.1.10"然后在终端中运行vagran reload