进入容器后
mysql 配置文件是放在 /etc/mysql/mysql.conf.d/mysqld.cnf,
vim /etc/mysql/mysql.conf.d/mysqld.cnf 在 [mysqld] 下加入一行: lower_case_table_names=1
或
docker run -p 3306:3306 --name mymysql -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/mysql_data -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7 --lower_case_table_names=1
在宿主机改好
[mysqld]
#不区分大小写lower_case_table_names=1
lower_case_table_names=1
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
#log-error = /var/log/mysql/error.log
# By default we only accept connections from localhost
#bind-address = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
也可以在宿主机改好用docker命令cp到容器里面
docker cp mysqld.cnf mysql:/etc/mysql/mysql.conf.d/mysqld.cnf
重启mysql容器
docker restart mysql
保存,退出容器;
执行sudo docker restart 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)
到此这篇关于docker mysql5.7如何设置不区分大小写的文章就介绍到这了,更多相关docker mysql5.7不区分大小写内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!