0x00 事由
日志系统开发完成了,服务已经部署到服务器上,也该把本地数据库上传上去了,于是就在docker上面安装了mysql:5.7,但是在开发环境中mysql是不区分大小写的,而docker上面的确实默认区分大小写,所以需要关闭大小写敏感这个选项。
0x01 步骤
首先进入容器内部
docker exec -it 容器ID /bin/bash
cd /etc/mysql/mysql.conf.d
vi mysqld.cnf
发现没有vi,那就装一下吧
apt-get update
apt-get install vim
vi mysqld.cnf
在结尾追加一行
lower_case_table_names=1
变成
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation. The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
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
lower_case_table_names=1
wq保存后,ctrl d退出容器,重启容器即可生效