sqlite连接使用用户名和密码

问题描述 投票:1回答:1

MySQLite连接使用用户名和密码,但我没有指定任何

Illuminate \ Database \ QueryException SQLSTATE [HY000] [1045]拒绝访问用户'homestead'@'localhost'(使用密码:YES)(SQL:select * from customers

laravel sqlite
1个回答
1
投票

此错误主要来自更改DB_DATABASE文件中的DB_USERNAMEDB_PASSWORD.env

打开.env文件并进行编辑。

DB_CONNECTION=sqlite
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=            // Your Database Name
DB_USERNAME=           // Your Database Username
DB_PASSWORD=          // Your Database Password

如果您在安装时没有默认用户名,则DB_USERNAME应设置为root

注意:如果数据库上没有设置密码,请将其清除DB_PASSWORD

.env编辑之后,必须清除缓存:

php artisan config:cache
© www.soinside.com 2019 - 2024. All rights reserved.