修改数据库字符集
ALTER DATABASE db_name DEFAULT CHARACTER SET character_name [COLLATE ...]
修改表字符集
ALTER TABLE tablename DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE tablename DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
修改列字符集
ALTER TABLE tablename CHANGE columnname columnname VARCHAR(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
查看编码
SHOW CREATE DATABASE db_name;
SHOW CREATE TABLE tablename;
SHOW FULL COLUMNS FROM tablename;