Laravel Homestead Vagrant Box Database Problems

后端 未结 7 2244
轮回少年
轮回少年 2020-12-30 17:11

I can\'t use the same database.php settings when browsing the local website in a browser (example.app:8000) and when using php artisan migrate.

If my database.php se

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-30 17:28

    You have to execute the migration command from inside the VM. First, you log into the VM:

    ssh vagrant@127.0.0.1 -p 2222
    

    After that, you just cd into your project's folder and run the migration

    cd Code/blog
    php artisan migrate
    

    The reason why this happens is because localhost:3306 from the perspective of your machine is one thing, from inside the VM is another.

提交回复
热议问题