Error When Laravel Migrate PDOException::("PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]")

when you try to migrate some table with using ORM, if it's error occur like on this example, so it will some step to fix the problem.
so follow this step:

this is the error example:


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

  at /home/dex/Learn/untitled folder/service/test/vendor/laravel/framework/src/Illuminate/Database/Connection.php:665
    661|         // If an exception occurs when attempting to run a query, we'll format the error
    662|         // message to include the bindings with SQL, which will make this exception a
    663|         // lot more helpful to the developer instead of just the database's errors.
    664|         catch (Exception $e) {
  > 665|             throw new QueryException(
    666|                 $query, $this->prepareBindings($bindings), $e
    667|             );
    668|         }
    669|

  Exception trace:

  1   PDOException::("PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]")
      /home/dex/Learn/untitled folder/service/test/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

  2   PDO::__construct("mysql:host=localhost;port=3306;dbname=test", "root", "toor", [])
      /home/dex/Learn/untitled folder/service/test/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

first stop the mysql service using command in terminal:
sudo service mysql stop

second restart mysql with using command in terminal :
sudo service mysql start --default-authentication-plugin=mysql_native_password
third login using mysql -u root -p "replace with your password"

forth, type this command in your terminal :
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'replace whit your_password';
 and try to migrate agian your table, done !
it's will fix your problems.

Comments

  1. In this manner my friend Wesley Virgin's tale begins in this SHOCKING AND CONTROVERSIAL VIDEO.

    As a matter of fact, Wesley was in the army-and shortly after leaving-he found hidden, "SELF MIND CONTROL" secrets that the CIA and others used to get whatever they want.

    These are the exact same secrets many celebrities (notably those who "come out of nowhere") and elite business people used to become rich and famous.

    You've heard that you utilize only 10% of your brain.

    Really, that's because the majority of your brain's power is UNCONSCIOUS.

    Perhaps this conversation has even taken place INSIDE your own mind... as it did in my good friend Wesley Virgin's mind seven years back, while driving an unregistered, beat-up bucket of a car without a driver's license and with $3.20 in his pocket.

    "I'm very fed up with living paycheck to paycheck! When will I become successful?"

    You've been a part of those those types of conversations, right?

    Your very own success story is waiting to happen. All you have to do is in YOURSELF.

    Watch Wesley Virgin's Video Now!

    ReplyDelete

Post a Comment