博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
怎样设置mysql的表不区分你大写和小写
阅读量:4942 次
发布时间:2019-06-11

本文共 2642 字,大约阅读时间需要 8 分钟。

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)

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

 

转载于:https://www.cnblogs.com/lytwajue/p/7261630.html

你可能感兴趣的文章
.Net Core Identity外面使用Cookie中间件
查看>>
【坐在马桶上看算法】算法1:最快最简单的排序——桶排序
查看>>
C#中泛型之Dictionary
查看>>
强连通分量
查看>>
使用Code First模式开发如何更新数据库(转载)
查看>>
sqoop导出工具
查看>>
Codeforces Round #376 (Div. 2)
查看>>
Codeforces 607D Power Tree 线段树 (看题解)
查看>>
写在人生的路上——2016年上半年总结
查看>>
员工选票系统-java
查看>>
C语言、C语言的起源以及类似C语言的编程语言的历史简直不要太漫长,我简单总结列表如下:...
查看>>
sp1.3-1.4 Neural Networks and Deep Learning
查看>>
JavaScript易错知识点整理
查看>>
Biological Clocks
查看>>
2018-10-11
查看>>
国内NLP的那些人那些会
查看>>
SQL 将一个表中的所有记录插入到一个临时表中
查看>>
nmea协议
查看>>
js 中对象的特性
查看>>
hdoj3714【三分】
查看>>