Laravel 5 PHP Artisan Migration不起作用 [英] Laravel 5 php artisan migrate does not work
问题描述
我使用Mac os x Yosemite 10.10
.我安装了最新的laravel version 5.1
.
我设置了Homestead,它运行的非常好.但是,当我尝试在Laravel应用中建立MySQL
连接时,在我的开发机器上运行php artisan migration时遇到错误.以下是我运行php artisan migration时看到的语句.
Im using Mac os x Yosemite 10.10
. I installed the lastest laravel version 5.1
.
I set up Homestead and it has been running great. However, when I try to make a MySQL
connection in my Laravel app, and am now experiencing errors when running php artisan migrate on my development machine. Following is the statement that I see when I run php artisan migrate.
[PDOException] SQLSTATE [HY000] [2002]没有这样的文件或目录
[PDOException] SQLSTATE[HY000] [2002] No such file or directory
我该如何解决这个问题?当我进入VM时,mysql正常工作.但是我不知道如何使用php artisan migration. 预先谢谢你.
How can I solve this problem? When I get into VM, mysql works fine. But I do not know how I can use php artisan migrate. Thank you in advance.
最佳
推荐答案
检查mysql服务器是否可用,并使用适当的sql驱动程序检查database.php database.php的路径
check mysql server is available or not and check database.php with proper sql driver path for database.php
project/config/database.php
在项目目录中检查您的.env文件,并检查数据库详细信息
check your .env file in project directory and check DB details
DB_HOST=localhost
DB_DATABASE=dbname
DB_USERNAME=username
DB_PASSWORD=password
这篇关于Laravel 5 PHP Artisan Migration不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!