Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel.env设置_Php_Laravel_Vagrant_Homestead - Fatal编程技术网

Php Laravel.env设置

Php Laravel.env设置,php,laravel,vagrant,homestead,Php,Laravel,Vagrant,Homestead,我现在使用Laravel已经有一段时间了,但每次我想迁移时,我都必须将我的DB_主机更改为127.0.0.1,然后如果我想查看我的webapp,我必须将其更改回localhost,否则会出现异常: PDOException in Connector.php line 55: SQLSTATE[HY000] [2002] Connection refused 我正在使用homestead这是我的homestad.yaml文件: --- ip: "192.168.10.10" memory: 20

我现在使用Laravel已经有一段时间了,但每次我想迁移时,我都必须将我的
DB_主机
更改为
127.0.0.1
,然后如果我想查看我的webapp,我必须将其更改回
localhost
,否则会出现异常:

PDOException in Connector.php line 55:
SQLSTATE[HY000] [2002] Connection refused
我正在使用homestead这是我的homestad.yaml文件:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Code
      to: /home/vagrant/Code

sites:
    - map: website.dev
      to: /home/vagrant/Code/website/public

databases:
    - homestead
我的
/hosts/etc
文件:

# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
192.168.10.10   website.dev
当我ping
localhost
时,我收到:

64 bytes from 127.0.0.1: icmp_seq=26 ttl=64 time=0.077 ms

我真的需要解决这个问题。请帮帮我

数据库用户必须同时拥有
localhost
127.0.0.1
的权限。我很确定它现在只在本地主机上运行。

数据库用户必须同时拥有
localhost
127.0.0.1
的权限。我很确定它现在只在本地主机上运行。

它说无法连接到数据库。你在标题中写对了,但没有发布你的
.env
,让我们看看!数据库用户必须同时拥有
localhost
127.0.0.1
的权限。我很确定它现在只在本地主机上运行..请注意homestead在mysql的
127.0.0.1
上使用
33060
端口,即使它只能在vm外部工作。它说不能连接到数据库。你在标题中写对了,但没有发布你的
.env
,让我们看看!数据库用户必须同时拥有
localhost
127.0.0.1
的权限。我很确定它现在只在本地主机上运行..请注意homestead在mysql的
127.0.0.1
上使用
33060
端口,即使它应该只在vm外部工作。感谢您的反应。当我想在mysql中为其授予权限时。我使用ssh登录:vagrant@homestead然后mysql-u homestead-p,然后使用GRANT选项将“@”上的代理授予“vagrant”@“localhost”,但这不起作用我该怎么办?提出了一个新问题。感谢您的反应。当我想在mysql中为其授予权限时。我使用ssh登录:vagrant@homestead然后mysql-u homestead-p,然后使用GRANT选项将“@”上的代理授予“vagrant”@“localhost”,但这不起作用我该怎么办?提出了一个新的问题。