0

I get this type of exception in all my Laravel projects.

Illuminate\Database\QueryException 

  SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = orchid and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
    667|         // If an exception occurs when attempting to run a query, we'll format the error
    668|         // message to include the bindings with SQL, which will make this exception a
    669|         // lot more helpful to the developer instead of just the database's errors.
    670|         catch (Exception $e) {
  > 671|             throw new QueryException(
    672|                 $query, $this->prepareBindings($bindings), $e
    673|             );
    674|         }
    675| 

      +34 vendor frames 
  35  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

I tried to solve it through .env setup.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=orchid
DB_USERNAME=root
DB_PASSWORD=password

But it's not working.

After then I installed composer require doctrine/dbal package in my Laravel project but it's not working. I cannot understand how to solve it.

youri
  • 3,685
  • 5
  • 23
  • 43
Shibaji Debnath
  • 1,105
  • 1
  • 10
  • 16

1 Answers1

1

I try this solution. It helps me.

  1. Log in as root to mysql
  2. Run this sql command: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Shibaji Debnath
  • 1,105
  • 1
  • 10
  • 16