• 怎样设置mysql的表不区分你大写和小写


    Linux上安装MySQL默认是数据库的表大写和小写敏感的。改动非常easy。仅仅要该一个mysql的配置文件就能够了。

    mysql> show tables;
    +--------------------------------------+
    | Tables_in_cddl                       |
    +--------------------------------------+
    | a1_equipment                         |
    | a1_equipment_batch                   |
    | actionby                             |
    | actionitem                           |
    | actionitemcomments                   |
    | actionitemdetail                     |
    | actionitemstatus                     |
    | cal_cost_element                     |
    | cal_cost_element_stat                |
    | cal_statistics                       |
    | changeduedate                        |
    | commisstionstartup                   |
    | copq                                 |
    | copq_category                        |
    | costbreakdown                        |
    | daily_statistic                      |
    | dbstudy                              |
    | dccddlist                            |
    | define_cost_element                  |
    | djpmomsactivity                      |
    | drawing                              |
    | dsystem_user                         |
    | dtproperties                         |
    | duser_rights                         |
    | edcr                                 |
    | edcr_2week                           |
    | edcr_status                          |
    | edcrchild                            |
    | engineering_action_tracking          |
    | engineering_action_tracking_analysis |
    | fincostone                           |
    | fincostonerpt                        |
    | fincosttwo                           |
    | fincosttworpt                        |
    | fincostvariance                      |
    | fincostvariancerpt                   |
    | findataforchar                       |
    | finemployee                          |
    | finemployee20120910                  |
    | finemployeehist                      |
    | finemployeehistback                  |
    | finexportone                         |
    | finexporttwo                         |
    | finheadcountone                      |
    | finheadcountonerpt                   |
    | finheadcounttwo                      |
    | finheadcounttworpt                   |
    | finheadcountvariance                 |
    | finheadcountvariancerpt              |
    | finhistversioncomment                |
    | finposition                          |
    | finpositionhist                      |
    | finpositionhistback                  |
    | finpositon20120910                   |
    | flight                               |
    | hotel                                |
    | hrcontact                            |
    | hy_temp                              |
    | hyresponsetime                       |
    | impacteddrawingnumber                |
    | jpmo_temp                            |
    | jpmoresponsetime                     |
    | meeting                              |
    | relatededcrnumber                    |
    | responsibleperson                    |
    | revisedscheduledate                  |
    | sm_temp                              |
    | smresponsetime                       |
    | sparepart                            |
    | sysconstraints                       |
    | syssegments                          |
    | systemparameter                      |
    | table_1_7_1                          |
    | table_1_7_2                          |
    | table_1_7_3                          |
    | table_1_7_3a                         |
    | table_1_7_3b                         |
    | table_1_7_3c                         |
    | table_appendix28                     |
    | trend                                |
    | trenddetail                          |
    | visitor                              |
    | visitprogram                         |
    | vp_engdeliverablesreport             |
    +--------------------------------------+
    84 rows in set (0.00 sec)

    mysql> select count(*) from TREND;
    ERROR 1146 (42S02): Table 'cddl.TREND' doesn't exist

    从上面能够看出trend表是存在的,仅仅只是是小写的保存在数据库里。

     

     

    让MYSQL不区分表名大写和小写的方法事实上非常easy:

    1.用ROOT登录。改动/etc/my.cnf

    2.在[mysqld]下增加一行:lower_case_table_names=1

    3.又一次启动数据库就可以

     

    [root@chicago init.d]# vi /etc/my.cnf
    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    skip-grant-tables
    lower_case_table_names=1

     

    [root@chicago init.d]# service mysql restart
    Shutting down MySQL..                                      [  OK  ]
    Starting MySQL......................................       [  OK  ]

     

    mysql> select count(*) from TREND;
    +----------+
    | count(*) |
    +----------+
    |       19 |
    +----------+
    1 row in set (0.00 sec)

    mysql> select count(*) from trend;
    +----------+
    | count(*) |
    +----------+
    |       19 |
    +----------+
    1 row in set (0.00 sec)

    从上面能够看出,此时已经不区分大写和小写了。

     

  • 相关阅读:
    ELK
    alerta 集中化告警信息 -zabbix
    Python安装第三方模块出错 No module named setuptools
    Centos7 搭建bind9.9
    DNS 处理模块 dnspython
    varnish 项目实战
    中文版Postman测试需要登陆才能访问的接口(基于Cookie)
    fireFox模拟 post请求、上传插件,火狐浏览器中文postman插件
    MySQL单表最大记录数不能超过多少?
    ApiPost(中文版postman)如何发送一个随机数或者时间戳?
  • 原文地址:https://www.cnblogs.com/lytwajue/p/7261630.html
Copyright © 2020-2023  润新知