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

MySQLdb._exceptions.OperationalError: Illegal mix of collations #74

Closed
sephirothac opened this issue May 14, 2022 · 6 comments · Fixed by #75
Closed

MySQLdb._exceptions.OperationalError: Illegal mix of collations #74

sephirothac opened this issue May 14, 2022 · 6 comments · Fixed by #75
Assignees
Labels
bug Something isn't working

Comments

@sephirothac
Copy link

Describe the bug
Hello, thank you for your fix for the 7/7 and 24/24 it is functional but since the update I have log returns.

Thank you very much for your help.

To Reproduce

docker-compose rm watcher
docker pull felix83000/watcher:latest
docker-compose run watcher bash
python manage.py migrate
exit
docker-compose up -d

Log
today at 15:25:39Job "main_watch (trigger: cron[day_of_week='mon-sun', minute='*/30'], next run at: 2022-05-14 15:30:00 CEST)" raised an exception
today at 15:25:39Traceback (most recent call last):
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
today at 15:25:39 return self.cursor.execute(sql, params)
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 75, in execute
today at 15:25:39 return self.cursor.execute(query, args)
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 206, in execute
today at 15:25:39 res = self._query(query)
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 319, in _query
today at 15:25:39 db.query(q)
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/MySQLdb/connections.py", line 254, in query
today at 15:25:39 _mysql.connection.query(self, query)
today at 15:25:39MySQLdb._exceptions.OperationalError: (1267, "Illegal mix of collations (utf8mb4_0900_ai_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='")
today at 15:25:39
today at 15:25:39The above exception was the direct cause of the following exception:
today at 15:25:39
today at 15:25:39Traceback (most recent call last):
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/apscheduler/executors/base.py", line 125, in run_job
today at 15:25:39 retval = job.func(*job.args, **job.kwargs)
today at 15:25:39 File "/app/Watcher/threats_watcher/core.py", line 76, in main_watch
today at 15:25:39 focus_on_top(settings.WORDS_OCCURRENCE)
today at 15:25:39 File "/app/Watcher/threats_watcher/core.py", line 216, in focus_on_top
today at 15:25:39 if TrendyWord.objects.filter(name=word):
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 324, in bool
today at 15:25:39 self._fetch_all()
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 1507, in _fetch_all
today at 15:25:39 self._result_cache = list(self._iterable_class(self))
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 57, in iter
today at 15:25:39 results = compiler.execute_sql(
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1361, in execute_sql
today at 15:25:39 cursor.execute(sql, params)
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
today at 15:25:39 return self._execute_with_wrappers(
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
today at 15:25:39 return executor(sql, params, many, context)
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
today at 15:25:39 return self.cursor.execute(sql, params)
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 91, in exit
today at 15:25:39 raise dj_exc_value.with_traceback(traceback) from exc_value
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
today at 15:25:39 return self.cursor.execute(sql, params)
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 75, in execute
today at 15:25:39 return self.cursor.execute(query, args)
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 206, in execute
today at 15:25:39 res = self._query(query)
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 319, in _query
today at 15:25:39 db.query(q)
today at 15:25:39 File "/usr/local/lib/python3.8/site-packages/MySQLdb/connections.py", line 254, in query
today at 15:25:39 _mysql.connection.query(self, query)
today at 15:25:39django.db.utils.OperationalError: (1267, "Illegal mix of collations (utf8mb4_0900_ai_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='")

@Felix83000 Felix83000 added the bug Something isn't working label May 14, 2022
@Felix83000
Copy link
Collaborator

Felix83000 commented May 14, 2022

Hello,

I will try to fix it next week.

Best regards,
Félix

@Felix83000
Copy link
Collaborator

Hello sephirothac,

Can you tell me your MySQL docker image version?

Thanks

@sephirothac
Copy link
Author

sephirothac commented May 16, 2022

Hello Felix83000,

The version that Mysql is MySQL Server 8.0.28-1debian10.

Thanks for your help.

Felix83000 added a commit that referenced this issue May 17, 2022
Fix #74 & Fix 403 CSRF Forbidden Error when connecting to /admin
Felix83000 added a commit that referenced this issue May 17, 2022
Fix #74 & Fix 403 CSRF Forbidden Error when connecting to /admin
Felix83000 added a commit that referenced this issue May 17, 2022
Fix #74 and Fix 403 CSRF Forbidden Error
@Felix83000
Copy link
Collaborator

Felix83000 commented May 17, 2022

Hello sephirothac,

Could you test the new fix?

Thanks

@Felix83000 Felix83000 reopened this May 17, 2022
@sephirothac
Copy link
Author

Hello Felix83000,

Thanks for your feedback, I just did the update for now it starts well, I'm waiting for the 30 mins cron if I get a log back.

Thanks a lot.

@sephirothac
Copy link
Author

Hello Felix83000,

No return of log (MySQLdb._exceptions.OperationalError: Illegal mix of collations) since 1h for me the problem is solved, thanks for your help.

Sincerely sephirothac

@Ygal13000 Ygal13000 assigned Ygal13000 and unassigned Felix83000 Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants