ignisrzeus
2 months ago
532
7
Forge

Access denied for user 'forge'@'localhost' (using password: YES)

Posted 2 months ago by ignisrzeus

Good Day Laracasts!

Today is my first time deploying a website via Laravel Forge. I've been following BitFumes' guide on how to deploy a laravel app via Forge, and everything has been working fine up until the database connection.

I have successfully logged in via SSH in my database, but whenever i run

mysql -uforge -p

I always get the result:

Access denied for user 'forge'@'localhost' (using password: YES)

The password that I input is the one that is located in the .env file in the Laravel Forge Environment section.

Currently stuck as i cannot successfully access my database because of this dilemma.

As of the moment, I'm not sure what I need to show you guys, but i simply named my database "forge" and didn't change anything as of the moment as i tried to strictly follow BItFumes' guide.

However, these are crucial files that I think are related to my dilemma:

database.php

'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            '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,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

config\app.php

 'key' => env('APP_KEY'),

.env

APP_NAME=Laravel
APP_ENV=production
APP_KEY=base64:Jihb8EG1he78Cv5ZhG8CRxAfyic3bWm+FetJbXWTqPg=
APP_DEBUG=false
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD="somerandomgeneratedpassword"

As I have stated above, I copy and simply paste "somerandomgeneratedpassword" (Obv. a placeholder) in the password section when being asked after running "mysql -uforge -p".

Any help will be greatly appreciated. Thank you very much!

Please sign in or create an account to participate in this conversation.