• 设置mysql表名大小写不敏感


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

    在windows上lower_case_table_names变量的缺省值为1; 在linux上为0; 在mac os上为2; 

    该变量值的详细定义如下:

    ValueMeaning
    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

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


    iefreer

     

  • 相关阅读:
    linux下压缩-解压命令
    配置 samba
    我如何在Linux shell脚本提示输入?
    乔布斯语录
    Oracle 查看表空间及扩容
    Linux添加/删除用户和用户组
    学习进度条
    作业8:单元测试练习(个人练习)
    作业7: 用户体验设计案例分析
    作业6 成绩录入系统设计 阶段一
  • 原文地址:https://www.cnblogs.com/bdzwater/p/3318857.html
Copyright © 2020-2023  润新知