Docker安装MySQL忽略大小写问题的问题
连接MySQL:
查看当前mysql的大小写敏感配置
show global variables like '%lower_case%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | ON |
| lower_case_table_names | 0 |
+------------------------+-------+
lower_case_file_system
表示当前系统文件是否大小写敏感,只读参数,无法修改。
ON 大小写不敏感
OFF 大小写敏感
进入docker的MySQL容器,编辑 /etc/mysql/mysql.conf.d/mysqld.cnf 文件,在[mysqld]下添加如下:
[mysqld]
lower_case_table_names=1
保存,退出容器;
执行sudo docker restart MySQL ,重启MySQL即可查看:
mysql> show global variables like '%lower_case%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 1 |
+------------------------+-------+
2 rows in set (0.00 sec)
完成!