Homestead-连接到我的数据库 [英] Homestead - Connecting to my database
问题描述
我刚刚创建了一个新的laravel项目,并且通过运行Homestead流浪者盒子
I just created a fresh laravel project and I'm using a Homestead vagrant box by running
无用的初始化laravel/homestead
vagrant init laravel/homestead
及之后
无家可归
当我使用vagrant ssh
时,它没有问题,我可以访问无所事事的盒子,但是,当我想使用Heidisql连接到DB时,会出现连接错误:
When I use vagrant ssh
it gives me no problem and I can acces the vagrant box, however when I want to connect to the DB with Heidisql I get a connection error:
无法连接到本地主机"(10061)上的mysql服务器
can't connect to mysql server on 'localhost' (10061)
这是我的设置
我使用的密码=秘密"
the password I'm using = "secret"
推荐答案
根据 .env文件也应进行相应的更新,因此在您进行首次迁移时不会出现问题,因为Laravel安装正在虚拟机中运行,因此您需要在其中使用默认端口3306.
The .env file should also be updated accordingly, so you won't have issues when running your first migration, as the Laravel installation is running inside the virtual machine you need the default port 3306 there.
这篇关于Homestead-连接到我的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!