linux上安裝mysql預設是資料庫的表大小寫敏感的。修改很簡單,只要該乙個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不區分表名大小寫的方法其實很簡單:
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)
從上面可以看出,此時已經不區分大小寫了。
設定Linux下Mysql表名不區分大小寫
1 linux下mysql安裝完後是預設 區分表名的大小寫,不區分列名的大小寫 2 用root帳號登入後,在 etc my.cnf中的 mysqld 後新增新增lower case table names 1,重啟mysql服務,這時已設定成功 不區分表名的大小寫 lower case table ...
設定Linux下Mysql表名不區分大小寫
設定linux環境下不區分大小 用root帳號登入後,在 etc my.cnf中的 mysqld 位置不要搞錯了 後新增新增lower case table names 1,重啟mysql服務。lower case table names引數詳解 lower case table names 0 其...
Ubuntu中mysql設定表名不區分大小寫
最近在公司優化乙個android專案,服務端已經部署到正式環境中,不能直接在正式環境中測試,需要部署一套測試的環境,後台又比較忙,於是自己來了,在ubuntu上安裝好jdk,tomcat和mysql後,準備開始部署啦。發現乙個問題,通過hibernate自動生成的有些表的名字全部變成了大寫,而在wi...