node-mysql2 icon indicating copy to clipboard operation
node-mysql2 copied to clipboard

How to set another collation (utf8mb4_unicode_ci)?

Open Hellek opened this issue 4 years ago • 2 comments

Hi! I have a database with next settings CREATE DATABASE catabase CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

When i send cyrillic symbols ('привет') thru my app, i get '???????' on database GUI, and when i get data thru app, i get something like 'Суперадмин' И tried this

const pool = require('mysql2/promise').createPool({
	...
	charset: 'utf8mb4',
	...
})

and this ones: charset: 'utf8mb4_unicode_ci', charset: 'UTF8MB4_UNICODE_CI', charset: 'UTF8MB4',

Hellek avatar Jan 19 '20 13:01 Hellek

any update?

akoidan avatar Apr 11 '22 00:04 akoidan

hi @Hellek @akoidan sorry for not getting back. Can you help by providing one single script that does all the setup and assertions ( create a schema, insert data, read back ) ? If the bug can't be reproduced by creating/inserting data from js maybe a shell script that calls mysql cli. That would help me get to the point where I can debug the issue much quicker

Also please specify a mysql server version you are using ( ideally a docker image name )

sidorares avatar Apr 11 '22 00:04 sidorares