日期:2014-05-16  浏览次数:20743 次

Windows和Linux系统下面MySQL的大小写敏感性不同

同样的建表脚本,在windows下所有的表名都成了小写的了,在建表脚本中,本来"goalsgroup"是"goalsGroup",可是用脚本建表 后就全成了小写了;在linux下用这个脚本建表则保持了表名的大小写状态。另外,列名在windows下和linux都能够区分大小写。
我的建表脚本如下:


use learndiarydb;
???????????????????????????????????????????????????????????????????????????????
DROP TABLE IF EXISTS `goalsGroup`;
CREATE TABLE `goalsGroup` (
? `groupID` tinyint(2) unsigned NOT NULL auto_increment,
? `groupName` varchar(60) NOT NULL,
? `writeDate` datetime default NULL,
? `lastUpdate` datetime default NULL,
? `goalsNum` tinyint(2) unsigned NOT NULL default '0',
? `groupPriority` tinyint(1) unsigned NOT NULL default '0',
? PRIMARY KEY? (`groupID`)
) TYPE=InnoDB;



在windows下的表名和列名:

mysql> show tables;
+------------------------+
| Tables_in_learndiarydb |
+------------------------+
| article??????????????? |
| emailresetpsd????????? |
| forbid???????????????? |
| goalsgroup???????????? |
| user?????????????????? |
| usergoal?????????????? |
| usermailgoal?????????? |
+------------------------+
7 rows in set (0.09 sec)
?
mysql>


mysql> describe goalsgroup;
+---------------+---------------------+------+-----+---------+----------------+
| Field???????? | Type??????????????? | Null | Key | Default | Extra????????? |
+---------------+---------------------+------+-----+---------+----------------+
| groupID?????? | tinyint(2) unsigned |????? | PRI | NULL??? | auto_increment |
| groupName???? | varchar(60)???????? |????? |???? |???????? |??????????????? |
| writeDate???? | datetime??????????? | YES? |???? | NULL??? |??????????????? |
| lastUpdate??? | datetime??????????? | YES? |???? | NULL??? |??????????????? |
| goalsNum????? | tinyint(2) unsigned |????? |???? | 0?????? |??????????????? |
| groupPriority | tinyint(1) unsigned |????? |???? | 0?????? |??????????????? |
+---------------+---------------------+------+-----+---------+----------------+
6 rows in set (0.09 sec)
?
mysql>

********************************************************************

在linux下的表名和列名:

mysql> show tables;
+------------------------+
| Tables_in_learndiarydb |
+------------------------+
| article??????????????? |
| emailresetpsd????????? |
| forbid???????????????? |
| goalsGroup???????????? |
| user?????????????????? |
| usergoal?????????????? |
| usermailgoal?????????? |
+------------------------+
7 rows in set (0.01 sec)
?
mysql>


mysql> describe goalsGroup;
+---------------+---------------------+------+-----+---------+----------------+
| Field???????? | Type??????????????? | Null | Key | Default | Extra????????? |
+---------------+---------------------+------+-----+---------+----------------+
| groupID?????? | tinyint(2) unsigned |????? | PRI | NULL??? | auto_increment |
| groupName???? | varchar(60)???????? |????? |???? |???????? |??????????????? |
| writeDate???? | datetime??????????? | YES? |???? | NULL??? |??????????????? |
| lastUpdate??? | datetime??????????? | YES? |???? | NULL??? |??????????????? |
| goalsNum????? | tinyint(2) unsigned |????? |???? | 0?????? |??????????????? |
| groupPriority | tinyint(1) unsigned |????? |???? | 0?????? |??????????????? |
+---------------+---------------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)
?
mysql>


******************************************************************

下面是网上一篇相同问题的blog,转自:http://www.zeali.net/entry/364

MySQL的大小写敏感性
zeal 2006-04-27 17:43 于 开发/理论