Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

FernandoD's avatar

Error using the authentication mechanism with MySQL

Hello. I've issues login a new who just properly registered in Laravel.

I have a LAMP server where I installed Laravel, I created a new MySQL database and inside the required tables users and password_resets.

1- I created a new project (laravel new blog)

2-I modified the files .env and .env.example to include the MySQL credentials

3- I executed (php artisan make:auth) to get the Laravel's authentication mechanism

4-While running the project I'm able to register a user by providing Name, Email, and declaring two times the password, once this part is done the user is declared as logged.

Issue 1: By closing the browser and reopening it again, I visit the login page and Laravel does not accept the user that was just registered.

Issue2: The browser keeps the user logged

Thank you in advance for your support.

0 likes
4 replies
FernandoD's avatar

I forgot to mention that once registered the user is created in the users table, also during the login process I do not get an error only a message that the combination (email, password is not accepted)

robrogers3's avatar
  1. when you say closing your browser? Do you mean exit?

  2. clarify what you mean by browser keeps the user logged in?

also, when trying to login again, are you clicking on the login 'button/link' on top right?

FernandoD's avatar

Thank you for answering my request

1-Yes, I register a new user and after that I got Dashboard You are logged in!

1.1 I exit Firefox completely, reopen it again and accessing the login page I got the the same message

1.2 I stopped the site execution, closed firefox, then "php artisan server" again and when I try to visit the login page same message.

2.- Now I click over the link Logout and retry to login again with the same user and password I get the following message These credential do not match our records.

Deeply appreciated your help. Greetings

FernandoD's avatar

Hello everyone. I installed the LAMP server in Debian, the MarianDB database engine was not compatible with the charset that Laravel was taking by default.

The solution I took for now is to modify the file /config/database.php on my application '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' => '', 'strict' => true, 'engine' => null, ],

        'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',

That solved my problem for now, I know that the ultimate solution is to fix the database server to accept the proposed collation and charset.

Thank you for your time and attention Greetings

Please or to participate in this conversation.