大家好,我是考100分的小小码 ,祝大家学习进步,加薪顺利呀。今天说一说[mysql]修改collation为utf8_bin「建议收藏」,希望您对编程的造诣更进一步.
mysql默认字段值区分大小写:
character-set-server=utf8
collation-server=utf8_bin
init-connect="SET NAMES utf8;"
SELECT DEFAULT_CHARACTER_SET_NAME "charset", DEFAULT_COLLATION_NAME "collation"
FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = "billing01";
SELECT DEFAULT_CHARACTER_SET_NAME "charset", DEFAULT_COLLATION_NAME "collation" ,SCHEMA_NAME
FROM information_schema.SCHEMATA;
mysql> SHOW CHARACTER SET LIKE "utf8";
+---------+---------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------+-------------------+--------+
| utf8 | UTF-8 Unicode | utf8_general_ci | 3 |
+---------+---------------+-------------------+--------+
1 row in set (0.00 sec)
https://blog.csdn.net/ghosind/article/details/83692869
mysql启动报错:
2019-10-29T08:52:41.945012+08:00 0 [ERROR] [MY-010936] [Server] COLLATION "utf8_bin" is not valid for CHARACTER SET "utf8mb4"
2019-10-29T08:52:41.946520+08:00 0 [ERROR] [MY-010119] [Server] Aborting
必须加character-set-server=utf8
my.cnf加
init_connect="SET collation_connection = utf8_bin"
也不行。
SHOW CHARACTER SET LIKE "utf8";
mysqld —-character-set-server=utf8mb4 —-collation-server=utf8mb4_bin
ALTER DATABASE database-name CHARACTER SET charset-name COLLATE collation-name;
ALTER DATABASE billing01 CHARACTER SET utf8 COLLATE utf8_bin;
ALTER DATABASE billing02 CHARACTER SET utf8 COLLATE utf8_bin;
ALTER DATABASE billing03 CHARACTER SET utf8 COLLATE utf8_bin;
ALTER DATABASE billing04 CHARACTER SET utf8 COLLATE utf8_bin;
https://www.cnblogs.com/benpao/p/11519029.html
代码100分
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/11183.html