在跨平台的程序设计中要注意到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 orCREATE 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 orCREATE 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

iefreer

设置mysql表名大小写不敏感的更多相关文章

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

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

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

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

  3. 【MySql】linux下,设置mysql表名忽略大小写

    [障碍再现] 状况描述01:     在LINUX下调一个程序经常报出找不到表,但是我明明是建了表的,     测试的时候,遇到一些问题,从Windows平台访问虚拟机中的Web应用,经常报出找不到表 ...

  4. ubuntu mysql表名大小写区分

    近期开发线上操作系统用的ubuntu,数据库用的mysql,突然发现mysql表名大写报错,找一下原因,看了下mysql的配置,果真可以设置,窃喜. 先找到你MySQL的my.cnf配置文件并修改,当 ...

  5. mysql数据库如何设置表名大小写不敏感?

    转自:https://blog.csdn.net/iefreer/article/details/8313839 在跨平台的程序设计中要注意到mysql的一些系统变量在windows和linux上的缺 ...

  6. MySQL表名大小写设置

    1 简介    在MySQL中,数据库对应数据目录中的目录.数据库中的每个表至少对应数据库目录中的一个文件(也可能是多个,取决于存储引擎).因此,所使用操作系统的大小写敏感性决定了数据库名和表名的大小 ...

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

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

  8. MySQL表名大小写敏感性

    Linux版MySQL 库名与表名是严格区分大小写的: 表的别名是严格区分大小写的: 列名与列的别名在所有的情况下均是忽略大小写的: 变量名也是严格区分大小写的: 修改步骤如下: 1. 编辑[/etc ...

  9. linux下设置mysql表名不区分大小写

    原文:http://blog.csdn.net/johnsonvily/article/details/6703902 1.Linux下mysql安装完后是默认:区分表名的大小写,不区分列名的大小写: ...

随机推荐

  1. codeforces 705B:Spider Man

    Description Peter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a ...

  2. Codeforces Round #280 (Div. 2) A , B , C

    A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  3. hdu 5890 Eighty seven 暴力+bitset优化背包

    Eighty seven Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 102400/102400 K (Java/Others) P ...

  4. PyCharm 的初始设置1

    PyCharm 的初始设置 PyCharm 的官方网站地址是:https://www.jetbrains.com/pycharm/ 01. 恢复 PyCharm 的初始设置 PyCharm 的 配置信 ...

  5. 设计高效sql一般经验谈

      1不用在sql语句使用系统默认的保留关键字 2尽量用exists 和 not exists 代替 in 和 not in 这条在sql2005之后,在索引一样,统计信息一样的情况下,exists ...

  6. 不一样的控制面板 GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}

    这是一个快速打开所有控制面板选项的方法.被称作Gode Mode或者Master Control Panel. 步骤很简单: 复制:超级控制面板.{ED7BA470-8E54-465E-825C-99 ...

  7. 【VS2013编译DirectX Tutorials时遇到的错误】FXC : error X3501: 'main': entrypoint not found

    修改于2015年9月6日: 去年写这篇解决方案的时候其实对着色器编程还一知半解,摸索了一个治标不治本的方法解决问题,结果被一个CSDN的博主原封不动抄了去,还打上个原创的标签= =,简直无语... 最 ...

  8. PNG24在ie6下的完美解决方法!(DD_belatedPNG)

    原网址:http://www.zjgsq.com/1629.html 之前写过一篇<js+css滤镜设置解决PNG24在IE6下显示问题> 解决方法不是很完美,使用起来也比较麻烦. DD_ ...

  9. python 调试命令

    部分整理自:http://flysnowxf.iteye.com/blog/1327677 启动调试: python -m pdb xxx.py 常用命令说明: l #查看运行到哪行代码 n #单步运 ...

  10. tests

    test