-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't connect to DB on the MySql version 8.0 #23961
Comments
There is a PR open to fix this. You'll find a workaround for your config there. #23948
|
Thank you very much. |
You're welcome. |
@BrandonSurowiec @Sotatek-HenryPham This and that are unrelated issues. The error happens because MySQL 8.0.4 changed default authentication mechanism from
Alternatively, you can specify authentication plugin on a per user basis. In short, for now MySQL 8 isn't really usable out of the box with most existing client implementations. |
@adiachenko how about running image mysql:8.0 via docker in gitlab runner in Laravel 5.6. |
@adiachenko thanks I got it working finally, although some mods needed... |
@adiachenko Thank you! Finally got it after several hours bangin' head on wall :( |
Didn't work for me. |
Don't forget to create a new user or update existing user to utilise the older way of authenticating. |
If you're using docker you should add the following
Doing it this way means you don't need the modify the |
Hello Illuminate\Database\QueryException : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations) at C:\MAMP\htdocs\bloger\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
Exception trace: 1 PDOException::("PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]") 2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=homestead", "homestead", "secret", []) Please use the argument -v to see more details. use MAMP |
@shimaashamia mysql 8.0 version brings significant changes to auth, therefore you need to make sure your app uses new logging authorization with DB. |
@chilio That's a solution for now, but I'm hoping that the framework will eventually have native support for new authentication method, so that it's following latest standarts and security measures. |
@autaut03 it is a workaround for now, and I also hope that Laravel maintainers will cover this scenario. |
`In Connection.php line 664: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = dbone and table_name = ) In Connector.php line 70: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client In Connector.php line 70: PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password] |
I personally think this issue should be reopened or resubmitted because the 'fixes' above are all workarounds. |
It works for me. Thanks! |
This is a PHP issue, Laravel can't do anything to fix it: https://bugs.php.net/bug.php?id=76243 |
This worked for me. Thanks. |
hi iam using webmin in vm ware and it is not working at all please suggest i am usnig webmin for that |
If you aren't connecting through docker and just locally on your machine, e.g, trying to run migrations through your laravel app, then the following works:
|
Thanks. I just found the answer to my comment. Please disregard. This is because of this error: php artisan migrate Illuminate\Database\QueryException: https://www.php.net/manual/en/mysqli.requirements.php https://stackoverflow.com/questions/55876981/php-7-3-4-does-not-support-caching-sha2-password The PHP mysqli requirements page still says caching_sha2_password plugin will be supported in a future PHP release, so no PHP version seems to support caching_sha2_password. Obviously, short of providing an appropriate patch to PHP, you are not the only one to eventually switch back to 'mysql_native_password' auth strategy on your DB server. |
This was painful, but in case others are stuck, this is how I debugged and fixed the problem |
I had the same issue when I changed my password on my SQL I tried the following things and it worked for me because of it has stored cache of .env file 1.first of the turn off artisan server and make changes to .env file and run these commands
then run the
Then it will work Happy cording |
Don't forget to update to PHP 7.4 |
@adiachenko
I also tried.
Any idea? |
One of my sites was still on PHP 7.3 and having issues connecting but my other sites that were on 7.4 were connection to MySQL just fine. Thank you @oleynikd for the tip! |
Hi, may I know where should I placed this line of code in details? I didnt find anything similar in my docker file |
你是怎么解决的?请问一下 |
如果沒必要用到8.0 建議把你docker mysql 降去5.8版本吧 我也是這樣就解決了這問題 |
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password 已经解决了哈 |
Hey everyone, I'm locking this issue because it either has gone off-topic, become a dumping ground for things which shouldn't be in an issue tracker or is just too old. Please try to discuss things further on one of the below channels: |
Description:
https://hub.docker.com/_/mysql/
When I build the new project using Docker, I pull the image
mysql:latest
and use it to build the containerMySql
. After that, I config and install my project and got the bug below.Steps To Reproduce:
The text was updated successfully, but these errors were encountered: