rails - mysql - utf8, utf8mb4 : Mysql2::Error: Incorrect string value error.
访问量: 364
refer to:
https://stackoverflow.com/questions/22464011/mysql2error-incorrect-string-value
1. change your database.yml:
development: adapter: mysql2 database: db username: password: encoding: utf8mb4 collation: utf8mb4_unicode_ci
2.run this SQL ( change YOUR_XX_NAME )
ALTER TABLE `YOUR_TABLE_NAME` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin, MODIFY YOUR_COLUMN_NAME VARCHAR(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin