Framework: Laravel Migrations with MySQL 8.0.x

Created on 2 Mar 2019  路  9Comments  路  Source: laravel/framework

  • Laravel Version: 5.8.2
  • PHP Version: 7.3.2
  • Database Driver & Version: mysql 8.0.15

Description:

Illuminate\Database\QueryException : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = ota_points and table_name = migrations)

Steps To Reproduce:

  • Install mysql 8.0 and use the new recommended password authentication (leave the legacy option)
  • Create new laravel app
  • Configure db in .env file
  • Try to migrate

Most helpful comment

open mysql in the terminal (just type mysql)
Use the following command
ALTER USER 'username here'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password here';
Leave the password empty if you don't want a password.
Use this user in your laravel env file for the MYSQL database.

All 9 comments

Duplicate of #23961.

This is a PHP issue, Laravel can't do anything to fix it: https://bugs.php.net/bug.php?id=76243

open mysql in the terminal (just type mysql)
Use the following command
ALTER USER 'username here'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password here';
Leave the password empty if you don't want a password.
Use this user in your laravel env file for the MYSQL database.

This is the best solution until PHP not fix this issue.

open mysql in the terminal (just type mysql)
Use the following command
ALTER USER 'username here'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password here';
Leave the password empty if you don't want a password.
Use this user in your laravel env file for the MYSQL database.

open mysql in the terminal (just type mysql)
Use the following command
ALTER USER 'username here'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password here';
Leave the password empty if you don't want a password.
Use this user in your laravel env file for the MYSQL database.

Thank you very much, this solution worked in my case

Don't forget to update to PHP 7.4

open mysql in the terminal (just type mysql)
Use the following command
ALTER USER 'username here'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password here';
Leave the password empty if you don't want a password.
Use this user in your laravel env file for the MYSQL database.

I was passing through the same issue. And the procedure above solved. Thank you very much @swrshah1

open mysql in the terminal (just type mysql)
Use the following command
ALTER USER 'username here'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password here';
Leave the password empty if you don't want a password.
Use this user in your laravel env file for the MYSQL database.

Thanks you.

open mysql in the terminal (just type mysql)
Use the following command
ALTER USER 'username here'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password here';
Leave the password empty if you don't want a password.
Use this user in your laravel env file for the MYSQL database.

Thanks sir

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shopblocks picture shopblocks  路  3Comments

SachinAgarwal1337 picture SachinAgarwal1337  路  3Comments

gabriellimo picture gabriellimo  路  3Comments

Fuzzyma picture Fuzzyma  路  3Comments

Anahkiasen picture Anahkiasen  路  3Comments