mysql数据库如何设置大小写不敏感_mysql数据库如何设置表名大小写不敏感?
转自:https://blog.csdn.net/iefreer/article/details/8313839
在跨平台的程序设计中要注意到mysql的一些系统变量在windows和linux上的缺省值是不同的, 比如mysql表名称的大小写变量.
在windows上lower_case_table_names变量的缺省值为1;
在linux上为0;
在mac os上为2;
该变量值的详细定义如下:
【mysql数据库如何设置大小写不敏感_mysql数据库如何设置表名大小写不敏感?】ValueMeaning
0
Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement. Name comparisons are case sensitive. You should not set this variable to 0 if you are running MySQL on a system that has case-insensitive file names (such as Windows or Mac OS X). If you force this variable to 0 with --lower-case-table-names=0 on a case-insensitive file system and access MyISAM tablenames using different lettercases, index corruption may result.
1
Table names are stored in lowercase on disk and name comparisons are not case sensitive. MySQL converts all table names to lowercase on storage and lookup. This behavior also applies to database names and table aliases.
2
Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement, but MySQL converts them to lowercase on lookup. Name comparisons are not case sensitive. This works only on file systems that are not case sensitive! InnoDB table names are stored in lowercase, as forlower_case_table_names=1.
如果想在linux环境中想设置表名为大小写不敏感, 那么可以通过如下的命令:
mysqld --SET-lower_case_table_names=1;
或者在mysql server的配置文件中添加配置项:
vi /etc/my.cnf
# The MySQL server
[mysqld]
set-variable=lower_case_table_names=1
原文:https://www.cnblogs.com/YuyuanNo1/p/8820516.html
推荐阅读
- mysql大小写敏感开关_MySQL数据库和表名大小写敏感开关的打开办法
- mysql8大小写敏感|mysql8大小写敏感 设置_Windows Mysql8设置大小写敏感
- 数据库|Linux环境Mysql大小写敏感-不生效
- 数据库|MySQL到底大小写敏感还是不敏感?
- 详解如何使用Python实现删除重复文件
- MySQL性能之count*|MySQL性能之count* count1 count列对比示例
- 小白也能看懂的Redis遍历键和数据库管理详解
- 大健康|商誉压顶、转型不畅,步长制药如何穿过上市“7年之痒”?丨钛媒体深度
- 一文看懂(什么是数字化转型,企业实施数字化转型3大难点如何解决())
- Centos安装MySQL8-学会这招全版本通吃