![](/img/trans.png)
[英]Laravel Homestead 5.3, can't php artisan migrate although .env and database.php info is correct
[英]Laravel 4 database.php can't access DB
我的工作計算機上有一個laravel4
應用程序。 我最近通過svn
將文件下載到我的家用計算機上,當我嘗試在瀏覽器中打開項目時,出現以下錯誤:
ErrorException (E_UNKNOWN)
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (View: C:\wamp\www\xzy.tld\app\views\layout.blade.php) (View: C:\wamp\www\xyz.tld\app\views\layout.blade.php)
這是我的database.php
文件:
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'xyz',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
我知道我的家用計算機不需要mysql
密碼的事實,所以我不知道為什么會這樣? 我應該運行某種composer
命令來更新我的項目嗎?
編輯:奇怪的是,如果我導航到框架內的Connector.php
類並var_dump
$config
變量,我得到以下信息:
array (size=9)
'driver' => string 'mysql' (length=5)
'host' => string '127.0.0.1' (length=9)
'database' => string 'xyz' (length=10)
'username' => string 'root' (length=4)
'password' => string 'root' (length=4)
'charset' => string 'utf8' (length=4)
'collation' => string 'utf8_unicode_ci' (length=15)
'prefix' => string '' (length=0)
'name' => string 'mysql' (length=5)
我不知道此信息來自何處,因為在我的database.php
文件中,密碼設置為none。 如果刪除了database.php
文件的所有內容,仍然會出現相同的錯誤。
聽起來您是從錯誤的配置文件中讀取的。 檢查兩個中的憑據
app/config/local/database.php
和
app/local/database.php
這可能意味着您要確定一台計算機上的本地環境在另一台計算機上不起作用,並且Laravel從不同的文件中進行讀取。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.