Skip to content
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

Support caching_sha2_password authentication (MySQL 8+) #112

Open
nazar-pc opened this issue Aug 26, 2019 · 7 comments
Open

Support caching_sha2_password authentication (MySQL 8+) #112

nazar-pc opened this issue Aug 26, 2019 · 7 comments

Comments

@nazar-pc
Copy link

MySQL 8 does not seem to be supported by this library, any plans to add such support?

@clue
Copy link
Contributor

clue commented Aug 26, 2019

@nazar-pc What problem are you seeing exactly? I haven't had a chance to give it a try yet, but if we can identify something that needs to be changed to support MySQL 8, we will take a look as soon as time permits 👍

https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password suggests it should be compatible for the most part. We should support caching_sha2_password as the default authentication plugin.

@nazar-pc
Copy link
Author

I get an exception during connection like this:

{
    "code": 1251,
    "message": "Client does not support authentication protocol requested by server; consider upgrading MySQL client"
}

@theUniC
Copy link

theUniC commented Sep 21, 2019

It's nothing about the library (except for the caching_sha2_password authentication plugin). If you want to make this library work you should make your mysql work with the mysql_native_password authentication plugin.

https://www.php.net/manual/en/mysqli.requirements.php
https://stackoverflow.com/questions/50026939/php-mysqli-connect-authentication-method-unknown-to-the-client-caching-sha2-pa

@recarv
Copy link

recarv commented Dec 12, 2019

I've been able to connect using the mysql_native_password authentication.

@mmoreram
Copy link
Contributor

@clue I think that this issue can be closed :)

@clue clue changed the title MySQL 8 support Support caching_sha2_password authentication (MySQL 8+) Aug 28, 2022
@kodmanyagha
Copy link

I faced an interesting thing. I changed caching_sha2_password to mysql_native_password but I still get same error. The solution is set bindto value in Connector class. For example:

        $connector = new Connector([
            'dns' => '127.0.0.1',
            'tcp' => [
                // We have to set this correct, otherwise you get that error:
                // https://github.com/friends-of-reactphp/mysql/issues/112
                //'bindto' => '192.168.0.1:0',
                'bindto' => '127.0.0.1:0',
            ],
            'tls' => [
                'verify_peer' => false,
                'verify_peer_name' => false,
            ],
        ]);

@SimonFrings
Copy link
Contributor

@kodmanyagha Thanks for your input on this, but I don't think this solved the problem the way you intended to. I can only guess as I don't know all the details here, perhaps you're using different authentication methods when connecting to different databases?

There are some helpful answers in here and I agree with @clue that support caching_sha2_password as the default authentication plugin should be a thing in the future to fully support MySQL 8. We could agree that the original question in this ticket seems to be answered (as @mmoreram rightfully pointed out to close this ticket), but I think we should leave this open and understand this more like feature request to support MySQL 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants