mysql设置数据库默认编码和表名不区分大小写

环境:mysql7.5

1、设置mysql的默认字符编码

只需在my.ini中的[mysqld]组名的末尾添加:
character-set-server=utf8
重启mysql

mysql> show variables like 'character%'
character_set_client	        utf8
character_set_connection	utf8
character_set_database	        utf8
character_set_filesystem	binary
character_set_results   	utf8
character_set_server	        utf8
character_set_system	        utf8
character_sets_dir	/usr/share/mysql/charsets/

2、配置表名不区分大小写

mysql是否区分大小写设置是由参数lower_case_table_names决定的,其中:
lower_case_table_names = 0 
区分大小写(即对表名大小写敏感)
mysql> show variables like "%case%";
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_file_system | ON    |
| lower_case_table_names | 0     |
+------------------------+-------+
lower_case_table_names = 1 
不区分大小写(即对表名大小写不敏感)
mysql> show variables like "%case%";
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_file_system | OFF   |
| lower_case_table_names | 1     |
+------------------------+-------+

  

posted @ 2020-09-23 15:13  苍茫宇宙  阅读(697)  评论(0编辑  收藏  举报