docker安装mysql,修改大小写设置

运行容器:

docker run --name mysql \
-v /home/docker/mysql/data:/var/lib/mysql \
-p 3306:3306 \
-p 33060:33060 \
-d \
mysql:5.7 \
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_general_ci

启动后的mysql是区分大小写的,进入容器

docker exec -it mysql /bin/bash

编辑配置文件:

/etc/mysql/mysql.conf.d/mysqld.cnf

添加lower_case_table_names=1到下面位置:

[mysqld] 
lower_case_table_names=1

边上mysql,执行:

show global variables like '%lower_case%';

返回下面结果 ,则修改生效:

+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_file_system | OFF   |
| lower_case_table_names | 1     |
+------------------------+-------+

 

你可能感兴趣的:(Docker)