创建了mysql表之后发现mysql默认表明区分大小写,系统是从oracle迁移过来的,为了避免不必要的麻烦,添加lower_case_table_names=1来忽略大小写。
添加完了重启之后发现:
mysql> show tables;
+---------------------+
| Tables_in_crmdb |
+---------------------+
| ACCOUNT |
| FEE_TYPE |
| INST_STATUS |
| MEMBER_ROLE |
| OFFER_MEMBER_IMAGE |
| OFFER_PROD_COMP |
| OFFER_PROD_FEE_TYPE |
| OFFER_PROD_NUMBER |
| OFFER_RELA |
| OFFER_ROLES |
| OFFER_SPEC |
| PROD_SPEC |
| PROD_STATUS_TYPE |
+---------------------+
删除上述表从建报错如下:
mysql> drop table INST_STATUS;
ERROR 1051 (42S02): Unknown table 'crmdb.inst_status'
mysql> show warnings;
+-------+------+-------------------------------+
| Level | Code | Message |
+-------+------+-------------------------------+
| Error | 1051 | Unknown table 'crmdb.account' |
+-------+------+-------------------------------+
原因是在修改lower_case_table_names之前就创建了上面的表,修改完之后无法访问:
mysql> show create table ACCOUNT;
ERROR 1146 (42S02): Table 'crmdb.account' doesn't exist
查看crmdb数据库目录下存在表定义文件:
[root@bssmysqlcsdb01 crmdb]# ll
total 156
-rw-rw---- 1 mysql mysql 9314 Aug 15 15:04 ACCOUNT.frm
-rw-rw---- 1 mysql mysql 8642 Aug 15 15:04 FEE_TYPE.frm
-rw-rw---- 1 mysql mysql 8644 Aug 15 15:04 INST_STATUS.frm
-rw-rw---- 1 mysql mysql 8640 Aug 15 15:04 MEMBER_ROLE.frm
-rw-rw---- 1 mysql mysql 9118 Aug 15 15:03 OFFER_MEMBER_IMAGE.frm
-rw-rw---- 1 mysql mysql 9002 Aug 15 15:04 OFFER_PROD_COMP.frm
-rw-rw---- 1 mysql mysql 8928 Aug 15 15:04 OFFER_PROD_FEE_TYPE.frm
-rw-rw---- 1 mysql mysql 9004 Aug 15 15:04 OFFER_PROD_NUMBER.frm
-rw-rw---- 1 mysql mysql 8940 Aug 15 15:04 OFFER_RELA.frm
-rw-rw---- 1 mysql mysql 9192 Aug 15 15:03 OFFER_ROLES.frm
-rw-rw---- 1 mysql mysql 9176 Aug 15 15:04 OFFER_SPEC.frm
-rw-rw---- 1 mysql mysql 9268 Aug 15 15:04 PROD_SPEC.frm
-rw-rw---- 1 mysql mysql 8654 Aug 15 15:03 PROD_STATUS_TYPE.frm
删除这些文件之后,查询crmdb中的表定义:
[root@bssmysqlcsdb01 crmdb]# pwd
/mysql/data/crmdb
[root@bssmysqlcsdb01 crmdb]# rm -f *
mysql> use crmdb
mysql> show tables;
Empty set (0.00 sec)
重启mysql,正常