问题
I'm on a Ubuntu 15.10 Yosemite using Laravel 5.2.*
Here is my .env file:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=Pastry
DB_USERNAME=root
DB_PASSWORD=243320
app\config\database.php
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'Pastry'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', '243320'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
emember when I got the message:
SQLSTATE[28000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)
Help me please!
回答1:
First glance conclusion: The app you're trying to load in the browser is not using the info in the .env and database.php files you're looking at.
Are you accessing the correct URL? Aren't you trying to access a vanilla Laravel installation in a different folder? A fresh install of 5.2 has homestead as username.
Check your url Check your virtualHost directory. Is the correct path used?
回答2:
Thank you for your guidance. I do not have access to the database. But the construction of migrations was run properly. But I can not run it for a test run:
public function index()
{
$com = new Categorys();
$com->name = 'ali';
$com->ename = 'hi';
$com->img = 'sdjf';
$com->save();
// return View('category.index');
}
来源:https://stackoverflow.com/questions/38860109/sqlstate28000-1045-access-denied-for-user-homesteadlocalhost-using-pas