[英]ampps/Laravel5: error:Access denied for user 'root'@'localhost'
I install laravel 5.2 on Ampps (windows 10) with this tutorial. 我使用本教程在Ampps(windows 10)上安装了laravel 5.2 。
it works. 有用。
But Now I want connect to mysql. 但现在我想连接到mysql。
I create a 'test1' DB and change these two files: 我创建了一个'test1'DB并更改了这两个文件:
config/database.php 配置/ database.php中
mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'test1'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
.env .ENV
DB_HOST=localhost
DB_DATABASE=test1
DB_USERNAME=root
DB_PASSWORD=
After that I restart apache. 之后我重启apache。
then in CMS I run this code: 然后在CMS中运行此代码:
F:\Ammps\www\quickstart>php artisan migrate
But I get this error: 但我得到这个错误:
error SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
I think I miss a step. 我想我错过了一步。
can please help me? 能帮帮我吗?
According to the Ampps FAQ you need the default mysql password: 根据Ampps FAQ,您需要默认的mysql密码:
1. Default MySQL root password is "mysql".
So add that to your .env file like this: 所以将它添加到.env文件中,如下所示:
DB_HOST=localhost
DB_DATABASE=test1
DB_USERNAME=root
DB_PASSWORD=mysql
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.