Skip to content

Instantly share code, notes, and snippets.

@sukeerthiadiga
Created September 23, 2012 17:05
Show Gist options
  • Save sukeerthiadiga/3772311 to your computer and use it in GitHub Desktop.
Save sukeerthiadiga/3772311 to your computer and use it in GitHub Desktop.
Mysql2::Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)
locate my.cnf
change character set and collation
[mysqld]
character_set_server = utf8
collation_server = utf8_general_ci
in console if your database is not huge.
ActiveRecord::Base.connection.tables.each do |table|
ActiveRecord::Base.connection.execute "ALTER TABLE #{table} CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment