MySQL Flask connection stopped working

ddsna
HOBBY

a year ago

Hi!
I'm getting this error now when connecting to my mysql db after redeploying the standard railway image for an updated mysql version.

sqlalchemy.exc.DatabaseError: (mysql.connector.errors.DatabaseError) 1524 (HY000): Plugin 'mysql_native_password' is not loaded

(Background on this error at: https://sqlalche.me/e/20/4xp6)

It seems my only option was to go through users to switch to a new password security setting as the previous default has removed. When exploring with the workbench I get this error
However, even when running this code I still get the error above.

connection_string = f"mysql+mysqlconnector://pythonapp:{__up_key}@{__url_db}:{__port_db}/{__up_db}"
engine = create_engine(connection_string, pool_recycle=360, echo=True, connect_args={'auth_plugin': 'caching_sha2_password'})

Naturally, all code is sensitivized for sharing.

2 Replies

ddsna
HOBBY

a year ago

f3f3aa54-1f32-4a2a-9e9a-61d26191712d


ddsna
HOBBY

a year ago

Naturally I'd love to upgrade my code's security and the provider closing down on an auth method is a pretty big sign to move into the direction they want us to - but it seems my code won't budge.


a year ago

append --mysql-native-password=ON to your database's start command


ddsna
HOBBY

a year ago

Attempted but doesn't seem to have an effect


ddsna
HOBBY

a year ago

1249459853798146000


ddsna
HOBBY

a year ago

Also FYI it's marked for complete deprecation so I'm not sure this is a real solution

1249460537259982800


a year ago

are you sure you did that correctly? it looks like you removed every other flag


ddsna
HOBBY

a year ago

There was no other flag previously, yes


a year ago

how long ago did you deploy this database


ddsna
HOBBY

a year ago

Well before the redeploy roughly 5 months, but the most recent redeploy that screwed things up was 6 days ago


ddsna
HOBBY

a year ago

The redeploy was meant to rebuild the image with a more recent version of mysql and nothing else.
The deployments are as basic as they come with no modifications on my end.


a year ago

then I think it's best to pin your service to I think mysql 8.30


a year ago

yeah it was deprecated in 8.4.0


ddsna
HOBBY

a year ago

I'm thinking about migrating the tables because obviously there's some issues with that as well - since they forced some tabular changes as well that make running servers in lower versions connected to 8.4.0 tables


a year ago

whatever works best for you!


nunommc
TRIAL

4 months ago

Hi,

The same situation happened to me. I restarted the mysql service for the first time, simply to reduce the resource limits, and the app never worked again.

I tried your suggestion, and it outputs the following on MySQL 9.

```
2025-03-05T08:41:08.127679Z 0 [ERROR] [MY-000067] [Server] unknown variable 'mysql-native-password=ON'.
```

I tried rolling back to a deploy from 2 months ago, and it also didn't address the issue. I'm unsure what could have caused this, when I simply tried to reduce the memory down from 8 GB.


nunommc
TRIAL

4 months ago

This comment on stackoverflow says that they had to remove the volume.. Having that it's not an option on production, what other solutions there are?


MySQL Flask connection stopped working - Railway Help Station