Scene: A database sql statement contains emoji emoticons, such as micro letter containing login nicknames emoticons, the database can not be inserted using utf8 will prompt 'Incorrect string value: \' \\ xF0 \\ x9F \\ x90 \\ xBE \\ xE5 \\ xAE ... \ 'for column \' nick_name \ 'at row 1',
Cause: loopback4 do the back-end database character set has been set to utf8mb4, but due to the mysql connector versions loopback4 use may be too low, there is the character set issue,
"mysql": "2.17.1",
"loopback-connector-mysql": "^5.4.2",
Solution, to directly modify node_modules / mysql / lib / ConnectionConfig.js line 55
;
Modification is completed, the resumption of direct nodejs to take effect.
Reference documents: https://github.com/mysqljs/mysql/pull/1408/commits/b6b7f06b88e9c899244fa6219933dbe6cbab2c89