在 MySQL 中,数据库和表其实就是数据目录下的目录和文件,因而,操作系统的敏感性决定数据库和表命名的大小写敏感。这就意味着数据库和表名在 Windows 中是大小写不敏感的,而在大多数类型的 Unix/Linux 系统中是大小写敏感的。

MySQL大小写敏感可以通过配置文件的lower_case_table_names参数来控制。

WINDOWS:

编辑MySQL安装目录下的my.ini 文件,在[mysqld]节下 添加 lower_case_table_names=0 (备注:为0时大小写敏感,为1时大小写不敏感,默认为1),可以实现MySql按照建表Sql语句的大小写状态来定义表名。

LINUX:

编辑/etc/my.cnf文件,在[mysqld]节下 添加 lower_case_table_names 参数,并设置相应的值 (备注:为0时大小写敏感,为1时大小写不敏感,默认为0)

PS: Identifier Case Sensitivity

How table and database names are stored on disk and used in MySQL is affected by thelower_case_table_names system variable, which you can
set when starting mysqld.lower_case_table_names can
take the values shown in the following table. This variable does notaffect case sensitivity of trigger identifiers. On Unix, the default value
of lower_case_table_namesis 0. On Windows the default value is 1. On Mac OS X, the default value is 2.

Value Meaning
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. Note that if you force this variable to 0 with --lower-case-table-names=0 on a case-insensitive filesystem 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 onlyon
filesystems that are not case sensitive! InnoDB table names are stored in lowercase, as for lower_case_table_names=1.

mysql大小写敏感(默认为1,不敏感)的更多相关文章

  1. 【已解决】Windows下 MySQL大小写敏感 解决方案及分析

    Windows下 MySQL大小写敏感配置 zoerywzhou@163.com http://www.cnblogs.com/swje/ 作者:Zhouwan 2017-3-27 最近在window ...

  2. MySQL大小写敏感的解决方案

    前言:对于MySQL的大小写敏感的影响,笔者在一个小项目中深刻的体会到:当想要查询一条数据时,总是出来两条或多条,后来发现是大小写敏感造成的原因,本文就该问题提出解决方案. 1.MySQL大小写敏感的 ...

  3. Centos7 下mysql大小写敏感问题

    在Centos7 下mysql大小写敏感问题,会导致程序运行时找不到对应的表. 解决办法: 第一步:编辑/etc/my.cnf文件,在[mysqld]节下 添加 lower_case_table_na ...

  4. windows下mysql数据库表名大小写不敏感

    最近新入职,领导让做个小功能先练练手.是一个添加分类的功能,有添加和列表,很简单.功能做完后提交,结果在线上出现一个大大的500. 但是我再本地环境下是正常的,我以为可能是php的版本不一致导致的问题 ...

  5. MySQL大小写敏感问题和命名规范

    注:本文大部内容参考自互联网相关文章 1.MySQL大小写敏感规则 MySQL中,一个库会对应一个文件夹,库里的表会则以文件的方式存放在文件夹内,所以,操作系统对大小写的敏感性决定了数据库和表的大小写 ...

  6. Linux环境下修改MySQL数据库对表名大小写不敏感

    Linux系统中MySQL对数据库名称和表名是大小写敏感的,这就导致了一些麻烦,虽然已经建立了表和数据,但因为大小写导致无法找到表. MySQL数据库对表名大小写不敏感的设置方法如下: 1.查看MyS ...

  7. mysql大小写敏感配置

    mysql大小写敏感配置show global variables like '%lower_case%'; show global variables like '%lower_case%'; &l ...

  8. 一个因MySQL大小写敏感导致的问题

    做一个积极的人 编码.改bug.提升自己 我有一个乐园,面向编程,春暖花开! 00 MYSQL对大小写敏感 见字如面,见标题知内容.你有遇到过因为MYSQL对大小写敏感而被坑的体验吗? 之前看过阿里巴 ...

  9. Docker容器内Mysql大小写敏感方案解决

    Docker容器内Mysql大小写敏感方案解决 一.(lower_case_table_names)参数说明 二.Docker 部署 MySql 并修改为大小写不敏感 2.1直接在Docker启动的时 ...

随机推荐

  1. (一)ROS系统入门 Getting Started with ROS 以Kinetic为主更新 附课件PPT

    ROS机器人程序设计(原书第2版)补充资料 教案1 ROS Kinetic系统入门 ROS Kinetic在Ubuntu 16.04.01 安装可参考:http://blog.csdn.net/zha ...

  2. MyEclipse如何全局搜索

    1全局搜索的启动方式 CTRL+H 2全局搜索自己选择搜索方式 自己选择要搜索的东西,简单吧,里面还有很多好玩的东西需要你去发现,加油! [正在看本人博客的这位童鞋,我看你气度不凡,谈吐间隐隐有王者之 ...

  3. Hazelcast源码剖析之Eviction

    v:* { } o:* { } w:* { } .shape { }p.MsoNormal,li.MsoNormal,div.MsoNormal { margin: 0cm; margin-botto ...

  4. activty栈管理

    题外话:我们有时在开发中,通常会有如下的需求:屏幕1-->屏幕2-->屏幕3-->屏幕4...,现在需要直接从屏幕4-->屏幕1,很多人会想到对activity进行管理得到对应 ...

  5. not in 前面/后面存在null值时的处理

    表声明 order_header表中有ship_method列: ship_method_map表中ship_method为主键列. 需求 找出order_header表中所有ship_method不 ...

  6. Effective C++ ——模板和泛型编程

    条款41:了解隐式接口和编译器多态 以public继承的类,

  7. 5.2、Android Studio截图

    Android Monitor允许你截取连接的设备或者虚拟机的屏幕,保存为PNG格式. 设备截图 1. 打开一个项目 2. 在设备或虚拟机中运行应用 3. 显示Android Monitor 4. 切 ...

  8. linux shell bash使用管道|和read结合时问题解决

    最近在将ksh转成bash运行的时候出现了问题.代码如下: echo $1 | sed 's/\..*$/''/' | read FILE_NAME 当使用ksh执行的时候没有问题,FILE_NAME ...

  9. linux2.6内核链表

    一.        链表数据结构简介      链表是一种常用的组织有序数据的数据结构,它通过指针将一系列数据节点连接成一条数据链,是线性表的一种重要实现方式.相对于数组,链表具有更好的动态性,建立链 ...

  10. [mysql5.6] 主从更换ip之后重新建立同步

    情况时这样的: 主从系统 centos6.5 mysql5.6 由于机房迁移ip地址变了,导致原来的主动无法同步,于是需要重新建立主从关系. 主 192.168.1.23 从 192.168.1.22 ...