不同版本区别
1. // 5.7字符集默认为latain,create table mytb01(id int,name char(10));
// 如上,创建表是不指定字符集,则该表就是latain。
// 当插入中文时,插入失败:insert into table mytb01 values(1,'小时');
// 须将字符集改成utf8类型的才可
// 而8.0版本,其默认字符集就是utf8mb4。因此,5.7需要修改字符集:
// 查看字符集命令:show variables like 'character%'; show variables like 'collation%';
// windows系统,修改mysql字符集:
// 1. 在my.ini配置文件中的[mysql]模块,添加一行:default-charracter-set=utf8mb4
// 2. 在[mysqld]模块中添加:character-set-server=utf8mb4,collation-server=utf8_general_ci
// 3. 重启服务