recently i was facing problem in inserting emoji and other 4 bytes character in my mysql database then i found that my mysql version was 5.1 and it does not support utf8mb4 so i upgraded to mysql 5.6 which supports utf8mb4 and in my collation i have the option to select utf8mb4.but when i try to insert directly in table row through phpmyadmin i am getting this error
refered this link also
http://dba.stackexchange.com/questions/59126/set-value-of-character-set-client-to-utf8mb4
1 row affected.
Warning: #1366 Incorrect string value: '\xF0\x9F\x9A\x8A k...' for column 'rajulp' at row 1
i googled and found that this is because the database is not supporting utf8mb4 characters and then i followed few tutorials in internet to update my.cnf file and restarted mysql server as well as server.
https://mathiasbynens.be/notes/mysql-utf8mb4
i tried almost all possible combination but again when i type this in sql it throws maximum as utf8 because of that i am unable to insert eboji and several 4 bytes character.
Punjab me 1Train? k niche 100 ?Sardar aa gaye..
output of below command in mysql
SHOW VARIABLES LIKE 'char%'
character_set_client utf8
character_set_connection utf8
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8
character_set_server utf8mb4
character_set_system utf8
character_sets_dir /usr/share/mysql/charsets/
please guide
Best Answer
I had the same problem with an Ubuntu installation of MySQL 5.6.23.
I had to edit /etc/mysql/my.conf and add these entries to these sections:
Then as root execute: service mysql restart
Both my webserver connections and my local (shell) mysql connections worked with utf8mb4.
The following are from a fresh command line instantiation of mysql:
As a final note, the "character_set_system" is always "utf8" according to the mysql 5.x specifications, so that is normal.