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

Compatibility Issue of MySQL 5.7 & 8.0 #779

Closed
billy1624 opened this issue Oct 29, 2020 · 5 comments
Closed

Compatibility Issue of MySQL 5.7 & 8.0 #779

billy1624 opened this issue Oct 29, 2020 · 5 comments

Comments

@billy1624
Copy link
Contributor

Hi, I was trying the library for the first time and connecting to MySQL. However, I found a compatibility issue on two different version of MySQL.

Using the same connection string mysql://username:password@127.0.0.1/db, it cannot login to MySQL 8.0 but successful on MySQL 5.7.

Error message when logging in MySQL 8.0 are as follows:

MySqlDatabaseError { code: Some("28000"), number: 1045, message: "Access denied for user \'username\'@\'localhost\' (using password: YES)" }

Thank you so much!!

@Handfish
Copy link

I also ran into this problem, but have more information and a solution.

MySQL 8.0 changed its default authentication plugin from mysql_native_password to caching_sha2_password. Since PHP doesnt understand caching_sha2_password, I had edited my user accounted previously to set it back to 5.7 defaults. This is what caused your error on my machine.

ALTER USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password'

In order to make connections with SQLX, it seems user account must be identified by the default authentication plugin. I've updated my user back tocaching_sha2_password and the connection works.

ALTER USER 'user'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'new_password'

@billy1624
Copy link
Contributor Author

Thanks!! @Handfish

@leontoeides
Copy link

Amazing! Thank you @Handfish!

@axzsd
Copy link

axzsd commented Dec 30, 2020

Thanks!!! @Handfish

@Vrajs16
Copy link
Contributor

Vrajs16 commented Nov 26, 2023

@abonander Can close as already fixed.

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

No branches or pull requests

6 participants