How do I set utf8mb4 for MySQL?

I'm working with utf8mb4 databases in MySQL and haven't found a way to set that on the connection. Is there a way? I've tried setting characterEncoding and characterSetResults to utf8mb4, but that gets a non supported encoding error.

If I run "set names utf8mb4" on a connection, it works after that, but it's annoying to have to remember to run that Every. Single. Time.

Is there a way to set utf8mb4 on a connection? Or is there a way to set a script to run on connection start so I can put "set names utf8mb4" on there?

4
5 comments

Unfortunately, there is no way to do this now :( https://youtrack.jetbrains.com/issue/DBE-4216

We also considering the ability to run initialization scripts: https://youtrack.jetbrains.com/issue/DBE-2606

0
Avatar
Permanently deleted user

Thanks for the response! Any idea on timelines? Those issues have been open for a year or two -- seems like a fairly simple fix for the specific case. Even just an option on the connection that's hard coded to run "set names utf8mb4" on connect would work.

2

@... I think I have this same problem. When you say "set names utf8mb4" to temporarily overcome this issue, where do you do it? Thanks!

0

Can anybody please tell me how this problem can be fixed? A database I am working with uses utf8mb4 and when editing it in phpMyAdmin everything works fine, but viewing or editing data in IntellIJ, it gets messed up.

0

open your dump.sql in an editor (i.e. vi) and add the line at the beginning:


set names utf8mb4;

and save, try again importing the dump

 

0

Please sign in to leave a comment.