Skip to content

Instantly share code, notes, and snippets.

@novaDev315
Last active February 18, 2020 20:42
Show Gist options
  • Save novaDev315/885ad70264fcb5a4819d89ddb0edb1a2 to your computer and use it in GitHub Desktop.
Save novaDev315/885ad70264fcb5a4819d89ddb0edb1a2 to your computer and use it in GitHub Desktop.
SQL helper query script
/* fix nodejs app connection mysql */
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
flush privileges;
/*** change database and table character encode ***/
/* for MySQL 5.5.3 abd newer version */
ALTER DATABASE databasename CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
/* for MySQL 5.5.2 or older which didn't support 4-byte UTF-8 */
ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment