docker-gitlab: Mysql2::Error: Illegal mix of collations upgrading to 9.3.x
Hi, trying to migrate a 9.2.7 instance to 9.3.x, migration stops with:
Mysql2::Error: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘=’: UPDATE merge_requests SET head_pipeline_id = ((SELECT max(ci_pipelines.id) FROM ci_pipelines WHERE ci_pipelines.ref = merge_requests.source_branch AND ci_pipelines.project_id = merge_requests.source_project_id)) WHERE merge_requests.id >= 1 AND merge_requests.id < 2/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/peek-mysql2-1.1.0/lib/peek/views/mysql2.rb:14:in `query’
Setting DB_COLLATION to utf8_general_ci, produces the same error. The database has been migrated over several versions of sameersbn/docker-gitlab and the DEFAULT_COLLATION_NAME of the database is utf8_unicode_ci and the tables have mixed collation settings: Collation is either utf8_unicode_ci or utf8_general_ci.
Any hints, what I can do?
Thanks Bories
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (9 by maintainers)
Starting the mysql 5.7 container with --character-set-server=utf8 --collation-server=utf8_general_ci and using DB_COLLATION=utf8_general_ci in the gitlab container, there was no need to use any ALTER TABLE statements in the database.
@maxc0d3r Having said that I suspect that you could change the collation of your existing tables to
utf8_general_ciand removeDB_COLLATION(which defaults also toutf8_general_ci). This should work. It worked for me.Edit: Fix spelling of collation twice 😱
@pmoralesp In case of
DB_COLLATION(only MySQL!) just make sure that your MySQL server has the same collation as yourDB_COLLATIONenvvar.