简体   繁体   中英

I uploaded a laravel project in cPanel and I'm getting this error: SQLSTATE[HY000] [1044] Access denied for user

Error: SQLSTATE[HY000] [1044] Access denied for user 'tfs_user'@'localhost' to database 'tfs' (SQL: select * from settings )

When i click login/registration page i'm getting this error. i can't understand what's the problem. I updated my .env file with correct database info.

.env file

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=tfs
DB_USERNAME=tfs_user
DB_PASSWORD=tfsdemo01

database.php file

'default' => env('DB_CONNECTION', 'mysql'),

'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' => true,
            'engine' => null,
        ],

How can i solve this error, can anyone help me please.

如果mysql服务器与您的应用程序在同一服务器上,则使用host作为localhost

DB_HOST=localhost

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM