Laravel宅基地数据库未找到问题

时间:2019-04-18 17:19:55

标签: laravel homestead

嗨,我正在尝试使用laravel家园。我运行了无所事事的ssh命令。

但是当我尝试在浏览器中访问时,出现此错误,

  

SQLSTATE [HY000] [1049]未知数据库“ mydb”(SQL:从*中选择*   id = 1限制1的用户)

这是我的.env文件,

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mydb
DB_USERNAME=homestead
DB_PASSWORD=secret

我的homestead.yaml

ip: "my IP"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: C:\wamp64\www\mysite
      to: /home/vagrant/code/mysite

sites:
    - map: homesteadmysite.local
      to: /home/vagrant/code/mysite/public
      type: apache

databases:
    - homestead

1 个答案:

答案 0 :(得分:0)

您必须在homestead.yaml中的数据库下添加数据库,

folders:
    - map: C:\wamp64\www\mysite
      to: /home/vagrant/code/mysite

sites:
    - map: homesteadmysite.local
      to: /home/vagrant/code/mysite/public
      type: apache

databases:
    - homestead
    - mydb

然后在cli中homestead.yaml存在的目录(您的Homestead文件夹)中运行 vagrant Provision 命令