转自:https://blog.csdn.net/iefreer/article/details/8313839

在跨平台的程序设计中要注意到mysql的一些系统变量在windows和linux上的缺省值是不同的, 比如mysql表名称的大小写变量.

在windows上lower_case_table_names变量的缺省值为1; 在linux上为0; 在mac os上为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. 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

    1. # The MySQL server
    2. [mysqld]
    3. set-variable=lower_case_table_names=1

mysql数据库如何设置表名大小写不敏感?的更多相关文章

  1. 设置mysql表名大小写不敏感

    在跨平台的程序设计中要注意到mysql的一些系统变量在windows和linux上的缺省值是不同的, 比如mysql表名称的大小写变量. 在windows上lower_case_table_names ...

  2. 更改MYSQL数据库不区分大小写表名

    今天郁闷死了,在LINUX下调一个程序老说找不到表,但是我明明是建了表的,在MYSQL的命令行下也可以查到,为什么程序就找不到表呢? 后来请教了一个老师才搞定,原来是LINUX下的MYSQL默认是要区 ...

  3. Mysql更改表名大小写不敏感

    编辑配置文件 vi /etc/my.cnf 在[mysqld]后添加添加 lower_case_table_names=1 重启服务 service mysqld stop service mysql ...

  4. linux环境下mysql默认是区分表名大小写的

    在linux环境下,mysql默认表明是区分大小写的,我们可以查看全局变量发现: mysql> show variables like 'lower%'; +------------------ ...

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

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

  6. mysql 远程登录与表名大小写问题

    好久没写博客了,这段时间在学习一个开源的项目,里面使用到了mysql,好久没使用mysql了.在使用过程中遇到了一个问题,远程登陆.报错信息很明显,连接失败.解决思路如下: 1. 首先检查到服务器网络 ...

  7. MySQL数据库查询所有表名

    查找指定库中所有表名 select table_name from information_schema.tables where table_schema='db_name'; 注:替换db_nam ...

  8. linux 下 设置 MySQL8 表名大小写不敏感方法,解决设置后无法启动 MySQL 服务的问题

    在安装完成之后,初始化数据库之前,修改 my.cnf 打开mysql配置文件 vim /etc/my.cnf 在尾部追加一行 lower_case_table_names=1 并保存,然后再初始化数据 ...

  9. 查询mysql数据库中所有表名

    查找所有表的语句 select table_name from information_schema.tables where table_schema='当前数据库';  

随机推荐

  1. II7.5配置IIS支持2G文件下载

    IIS默认支持下载在20M让IIS7.5支持大文件下载,有两个地方 1.打IIS管理器->asp->点限制属性+->设置最大请求实体主体限制为2147483648 2.打开路径C:\ ...

  2. 代码覆盖率?coverage

    http://www.infoq.com/cn/articles/test-coverage-rate-role 代码覆盖率?coverage   http://www.cnblogs.com/cod ...

  3. 213. String Compression【easy】

    Implement a method to perform basic string compression using the counts of repeated characters. For ...

  4. js----Open()函数

    JS中open()函数介绍 window=object.open([URL ][, name ][, features ][, replace]]]]) URL:新窗口的URL地址 name:新窗口的 ...

  5. java调用c#开发的webservice

    使用jdk自带的wsimport工具生成代理类 c:\Program Files\Java\jdk1..0_121\bin>wsimport -keep -encoding utf- -d d: ...

  6. Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' 解决方法

    1. 代码 SHOW VARIABLES LIKE 'character_set_%'; 查看一下 显示 +--------------------------+------------------- ...

  7. java printf long

    System.out.printf("%d\n", 1000000000000000000L); 

  8. toString() 和 (String) 以及 valueOf() 三者的对照关系[java]

    简述 在Java中,往往需要把一个类型的变量转换成String 类型.作为菜鸟,有时候我会使用(String) data,有时候就使用data.toString(),如果不行还会试试 String.v ...

  9. ES6快速入门使用

    https://www.jianshu.com/p/061304806bda Babel-webpack的配置 Bebal官方文档 前段项目我想使用ES6的语法我应该怎么做呢?我们可以查看Babel的 ...

  10. java 搭建web项目

    从git到maven都是莫名其妙的装上了.... 然后看了下报错,是数据的事,把链接字符串一改,数据库一建,ok,跑起来了 基本上没任何问题,唯一的问题就是我的网速太慢,maven了一夜的样子....