I have this project running on Laravel 5.8 and Database on Mysql using XAMPP server.
This is my .env
file:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
This is my config/database.php
file:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => false,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
and also created a Database in Xampp named homestead
.
this error is showing: SQLSTATE[HY000] [1045] Access denied for user 'user'@'localhost' (using password: YES) (SQL: select * from
userswhere
email = [email protected]
CodePudding user response:
you need to provide db_name, mysql user_name and password in your .env file. for xampp default username is 'root' and no password. so update your .env file
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=matkagu_satta
DB_PASSWORD=