This is how I connect to my database on my Windows cmd: mysql -u mydb -h myip -p
.
It has always worked since I tried to swap my utf8 database to utf8mb4. The changes I apply with php or java work fine and I can see those characters correctly when loading from php, java or phpmyadmin but not on my cmd.
I have tried adding --default-character-set=utf8
and --default-character-set=utf8mb4
to the cmd connection with no succeed. It is curious, by the way, that if I run a simple sentence like SELECT '☺';
it shows that character correctly.
Am I missing something?
Based on the findings of danibg in the end of our brainstorming session, he has found this link which describes that this is a MySQL bug which was applicable to 5.5, used by the op and apparently this was fixed for MySQL 5.6+
We tested 5.6 version of client against 5.5 version of server, especially with respect to non ANSI characters. The 5.6 client worked as expected and the issue mentioned in this bug was also fixed.
As a result, the solution is as follows: