MySQL utf8mb4

Seems like mysql's 'utf8mb4' character encoding is not supported by DataGrip. Is this being planned to change anytime soon?

2 comments
Comment actions Permalink

Hello Tuan,

Try to append database url connection string with "character_set_server=utf8mb4". See http://stackoverflow.com/a/10959780/2000323

If issue remains, please specify the exact problem you have.

 

UPD: most likely the issue is with the encoding on a client side, so the character_set_server property will not help here. MySQL jdbc driver also lets user to change encoding on a client side, and the option for this is characterEncoding which can be set in Advanced tab of the Data Source properties dialog. Please try to set it to this encoding.

-3
Comment actions Permalink

character_set_server = utf8mb4 must be specified on the server side (i. e. in my.cnf), under the [mysqld] section.

  • Generally, if both character_set_server and character_set_database (for the given database) are set to utf8mb4, that's it, utf8mb4 should just work.
  • If, on the other hand, your character_set_server is set to some other value, but character_set_database is still utf8mb4 (i. e. the database can still hold utf8mb4 data), you need to additionally "cast" your parameters and literals, e.g.: INSERT INTO unicode_test (value) VALUES (_utf8mb4 '𤭢').
  • Additionally, if your character_set_server is set to neither utf8 nor utf8mb3 nor utf8mb4, you need to explicitly force your JDBC connection into Unicode mode, by setting the characterEncoding connection property to UTF-8.
0

Please sign in to leave a comment.