mysql 5.7设置数据库大小写敏感

时间:2021-05-11 00:52:01

1 此处讲的是windows环境下的mysql配置,小编用的是win10系统;

2 安装完mysql后,数据库默认是大小写不敏感的;

3 修改my.ini文件:

C:\ProgramData\MySQL\MySQL Server 5.7\my.ini

在[mysqld]下添加:lower_case_table_names=2

=================================================================================================================

# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]


# pipe
# socket=0.0
port=3306


[mysql]
no-beep


default-character-set=utf8




# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
# server_type=3
[mysqld]


# The next three options are mutually exclusive to SERVER_PORT below.
# skip-networking


# enable-named-pipe


# shared-memory


# shared-memory-base-name=MYSQL


# The Pipe the MySQL Server will use
# socket=MYSQL


# The TCP/IP Port the MySQL Server will listen on
port=3306


# Path to installation directory. All paths are usually resolved relative to this.
# basedir="C:/Program Files/MySQL/MySQL Server 5.7/"


# Path to the database root

datadir=C:/ProgramData/MySQL/MySQL Server 5.7/Data

lower_case_table_names=2