1

i have set my database like this

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=test123
DB_USERNAME=root
DB_PASSWORD=16011996

in my .env

but when i run php artisan migrate i got error something like this

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

i have setup in my mysql about the schema_table using test123 but there is still error like that. how to fix it. i also try using 127.0.0.1 and using localhost but still got an error

that error is when i use mysql 8.0

i also have set the user as alter user using this code

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '16011996';
Query OK, 0 rows affected (0.01 sec)

and it is oke but i still got error like that

julolo
  • 47
  • 1
  • 5
  • Are you sure your connection information is right? – ali Falahati Apr 26 '21 at 07:54
  • What versions of PHP, Laravel and MySQL are you using? – Nazgot Apr 26 '21 at 07:54
  • Can you connect MySQL shell? if you can connect to the shell use following command: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; – ali Falahati Apr 26 '21 at 07:55
  • Have you tried to clear cache? – Kaleem Shoukat Apr 26 '21 at 08:04
  • Have you tried https://stackoverflow.com/questions/52364415/php-with-mysql-8-0-error-the-server-requested-authentication-method-unknown-to or https://stackoverflow.com/questions/50026939/php-mysqli-connect-authentication-method-unknown-to-the-client-caching-sha2-pa solutions? – apokryfos Apr 26 '21 at 08:10
  • yes i have try to clear cache.... and for the mysql server i use is 8.0. but when i change use mysql default from xampp and set no password i got error like this : SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = gocement and table_name = migrations and table_type = 'BASE TABLE') – julolo Apr 26 '21 at 08:22
  • have you installed any other web server like `wamp` or `lamp` with `xampp`? because this error occurs only when there's a conflict between resources. – Hassaan Ali Apr 26 '21 at 08:28
  • no i only use xampp for webserver for my php project – julolo Apr 26 '21 at 08:31
  • Just clear cache and try again – OLIVIERS Apr 26 '21 at 09:07

0 Answers0