Mysql 5.7 配置允许存入emoji

[mysqld]
character-set-server=utf8mb4

[mysql]
default-character-set=utf8mb4

只要修改my.ini(位置:C:ProgramDataMySQL)文件,然后重启mysql服务即可.

注意数据库的编码为utf8mb4

SHOW VARIABLES LIKE 'character_set%';

 

Mysql中导出表格的信息

SELECT
	COLUMN_NAME AS 列名,
	cast(COLUMN_TYPE as CHAR) AS 数据类型,
	cast(DATA_TYPE as CHAR) AS 字段类型,
	CHARACTER_MAXIMUM_LENGTH AS 长度,
	IS_NULLABLE AS 是否为空,
	COLUMN_DEFAULT AS 默认值,
	COLUMN_COMMENT AS 备注
FROM
	INFORMATION_SCHEMA. COLUMNS
WHERE
	table_schema = 'tobacco_asset'
AND 
        table_name = 'asset_base'

这样可以查出对应的表格每个字段的信息