Home > Software engineering >  mysql.connector.errors.NotSupportedError: Authentication plugin 'mysql_native_password' is
mysql.connector.errors.NotSupportedError: Authentication plugin 'mysql_native_password' is

Time:11-24

I am fighting to find a solution for my problem:
When I start my Python application in my IDE, the database connection is working fine. But when I build an exe with pyinstaller with the following command python3 -m PyInstaller .\home.py and start the application and trigger the connection to the db it gives me the following error:

"mysql.connector.errors.NotSupportedError: Authentication plugin 'mysql_native_password'is not supported"

Previously I had the same error with "caching_sha2_password" instead of "mysql_native_password", then I changed the db plugin to "mysql_native_password" but it still doesn't work in the exe.
My database is running in a Docker Container. The root user, which I use for the connection has also mysql_native_password as the authentication plugin.

enter image description here

However, somehow the connection to the db works every time when I start my application from my IDE. This problem only occurs, after I have exported my application into an exe with pyinstaller.

The connection to the db looks like this:

mysql.connector.connect(
      host="localhost",
      user="user",
      passwd="password",
      database="db_name"     
    )

And yes, I have already checked, that I only have mysql-connector-python installed.

I would be very glad if you could help me out, as this is the final step of my application to be ready for shipment.
Thank you in advance!

CodePudding user response:

After I could not find an answer for my problem, I just switched to Postgres and used the corresponding Python driver. Now it works!

  • Related