Skip to content

Instantly share code, notes, and snippets.

@Arxero
Created July 30, 2020 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arxero/a6ec6d6345a1b3422014d1e3a83f1a1b to your computer and use it in GitHub Desktop.
Save Arxero/a6ec6d6345a1b3422014d1e3a83f1a1b to your computer and use it in GitHub Desktop.
FIX for Error Code: 1366. Incorrect string value: '\xF0\x9F\x98\x98' for column
Info > https://stackoverflow.com/questions/8906813/how-to-change-the-default-charset-of-a-mysql-table
SELECT * FROM `gw-local-2`.posts;
SET character_set_system = utf8mb4;
UPDATE `gw-local-2`.posts SET content = '😘 asd' where id='9552a88e-cd97-4130-8daa-d0bb48977ebc';
SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
/* The actual fix */
ALTER TABLE `gw-local-2`.posts
CHANGE COLUMN content content varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment