Skip to content

Compatibility Issue of MySQL 5.7 & 8.0 #779

Closed

Description

@billy1624

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:[email protected]/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!!

Activity

  1. Handfish commented on Nov 18, 2020

    @Handfish

    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'
    
  2. billy1624 commented on Nov 23, 2020

    @billy1624
    ContributorAuthor

    Thanks!! @Handfish

  3. leontoeides commented on Dec 7, 2020

    @leontoeides

    Amazing! Thank you @Handfish!

  4. axzsd commented on Dec 30, 2020

    @axzsd

    Thanks!!! @Handfish

  5. Vrajs16 commented on Nov 26, 2023

    @Vrajs16
    Contributor

    @abonander Can close as already fixed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions