Advertisement
thesuhu

MySQL Collation

Jan 20th, 2022 (edited)
1,511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.92 KB | None | 0 0
  1. -- error Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '='
  2. -- solusi, samakan collations tabel yang beda, samakan dengan collation table yang di information_chema
  3. -- lihat dulu collation semua table
  4. SELECT table_schema, table_name, column_name, character_set_name, collation_name
  5. FROM information_schema.columns
  6. WHERE collation_name = 'latin1_general_ci'
  7. ORDER BY table_schema, table_name,ordinal_position;
  8. -- ubah collation tabel yang dipilih
  9. ALTER TABLE tbl_name CONVERT TO CHARACTER SET latin1 COLLATE 'latin1_swedish_ci';
  10.  
  11. -- contoh case error
  12. -- Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'
  13. -- solusi:
  14. ALTER TABLE <tabel terkait> CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci';
  15.  
  16. -- find out the charset used in the server
  17. SHOW VARIABLES LIKE 'character_set%';
  18. SHOW VARIABLES LIKE 'collation%';
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement