(macOs) Error: django.db.utils.OperationalError: (2000, 'Unknown MySQL error') #158411
Replies: 3 comments
-
|
I figured out the reason: |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
-
|
What you found actually makes sense, especially on newer macOS environments with Apple Silicon (M1/M2).
I have seen similar cases where: django.db.utils.OperationalError: (2000, 'Unknown MySQL error')appears even though:
Switching to: 'ENGINE': 'mysql.connector.django'works because it uses Oracle's pure Python MySQL connector instead of the compiled One thing I would also recommend checking is whether Sometimes reinstalling fixes it: brew install mysql-client
pip uninstall mysqlclient
pip install mysqlclientand making sure environment variables like these are set correctly before installation: export PKG_CONFIG_PATH="$(brew --prefix mysql-client)/lib/pkgconfig"Also, this line may cause problems depending on DB permissions: "init_command": "SET GLOBAL max_connections = 1024",because many remote MySQL users do not have permission to run global configuration commands. You could try removing it temporarily to rule that out as well. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Body
Hi All,
I am working on Project using Django on macOS.
I am trying to connect to the MySQL database from remote server, but its giving error when i used macOS. Although it used to work well when i used Linux one.
Here is my part of settings.py
Here is part of my dev-cluster.sh
When I tried to run the command:
python manage.py runserver 0.0.0.0:8000I got this Error:
django.db.utils.OperationalError: (2000, 'Unknown MySQL error')I did check the connection to the host (lb-dev) by pinging it or connecting it using DataGrip and it worked completely.
Can anyone help. Has anything changed? Am I doing anything wrong?
Thanks,
Van
Guidelines
Beta Was this translation helpful? Give feedback.
All reactions