我试图将laravel连接到数据库,但我遇到了问题。
我收到了这些错误:
1 PDOException ::(" SQLSTATE [HY000] [1045]用户访问被拒绝' @' localhost'(使用密码:否)" ) C:\ Users \ andre \ Dropbox \ College \ Project \ Rentable \ vendor \ laravel \ framework \ src \ Illuminate \ Database \ Connectors \ Connector.php:68
2 PDO :: __ construct(" mysql:host = localhost; port = 3308; dbname = rentable"," root","",[] ) C:\ Users \ andre \ Dropbox \ College \ Project \ Rentable \ vendor \ laravel \ framework \ src \ Illuminate \ Database \ Connectors \ Connector.php:68
这是我的.env文件
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3308
DB_DATABASE=rentable
DB_USERNAME=root
DB_PASSWORD=
这是localhost上数据库的屏幕截图:
答案 0 :(得分:1)
本地安装的默认密码很可能是root
,secret
或password
,请尝试.env
答案 1 :(得分:0)
在config / database.php中检查数据库参数。你应该有这样的东西
do {
Write-Host " Enter number of VM's that you would like to create. " -NoNewline ;
write-host "[VMs] : " -ForegroundColor Yellow -NoNewline;
$NumberOfVM = "Notok"; $NumberOfVM = Read-Host;
if($NumberOfVM-ne $Null -and $NumberOfVM.Length -le 30 -$NumberOfVM)
{Write-Host "ok" -NoNewline}else{Write-Host "Are You Kidding Me?!" -F Red -B Yellow}}
until($NumberOfVM -eq "ok")