×¢ÒâMysqlÊý¾Ý½Ø¶Ï
Beware of MySQL Data Truncation
http://www.mysqlperformanceblog.com/2009/02/07/beware-of-mysql-data-truncation/
±ÈÈ磺ÓÐÒ»¸ö±íaritcleºÍÁíÒ»¸ö±íarticle_comment£¬¹ØÁªÊÇarticleµÄid
CREATE TABLE `article` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
CREATE TABLE `article_comment` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`text` varchar(200) NOT NULL,
`article_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `art_id` (`article_id`),
CONSTRAINT `art_id` FOREIGN KEY (`article_id`) REFERENCES `article` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;
set sql_mode='';
insert into article values(12345678901,'name1');
insert into article_comment(text,article_id) values('text1',12345678901);
insert into article_comment(text,article_id) values('text2',12345678902);
²é¿´Êý¾Ý£º
article±í
4294967295 name1
article_comment±í
1 text1 4294967295
2 text2 4294967295
´ÓÖпÉÒÔ¿´³ö£¬±¾À´µÚ¶þ¸ö²åÈëµÄÆÀÂÛÏë¹ØÁªÁíÒ»¸öÎÄÕ£¬µ«ÊÇÈ´¹ØÁªµ½Á˵ÚһƪÎÄÕ£¬ÕâÊÇÒòΪMysqlµÄData Truncation
show warningsÏÔʾ
Warning | 1265 | Data truncated for column 'article_id' at row 1
Õâ»áÔì³É£º
£¨1£©ÆÀÂÛ¹ØÁªµ½´íÎóµÄÎÄÕÂ
£¨2£©Í¬Ò»ÆªÎÄÕ¹ØÁªµ½Ðí¶àµÄÆÀÂÛ£¨Õâ»áÔì³ÉÐÔÄÜÎÊÌ⣩
ÔõÑù½â¾öÄØ£¿
set sql_mode='STRICT_ALL_TABLES';
insert into article_comment(text,article_id) values('text1',12345678903);
Õâ»á±¨´í£º
[SQL] insert into article_comment(text,article_id) values('text1',12345678903);
[Err] 1264 - Out of range value for column 'article_id' at row 1
Òò´ËÒ²¾Í±ÜÃâÁËÉÏÊöÎÊÌâ¡£
Ïà¹ØÎĵµ£º
#ÐÂÔöÒ»¸ö×ֶΣ¬Ä¬ÈÏֵΪ0£¬·Ç¿Õ£¬×Ô¶¯Ôö³¤£¬Ö÷¼ü
alter table tabelname add new_field_name field_type default 0 not null auto_increment ,add primary key (new_field_name);
#Ôö¼ÓÒ»¸öÐÂ×Ö¶Î
alter table tableName ......
Ò»¡¢MYSQLµÄµ¼³ö
½øÈëmysql°²×°Ä¿Â¼£¬½øÈëbin
ÔÚÃüÁîÐÐģʽÏ´òÈ룺
³ÌÐò´úÂë
mysqldump -u root -p hibernate > c:/hibernate.sql
ÆäÖÐ-u ±íʾÓû§
-p±íʾÓû§ÐèÒªÈÏÖ¤
hibernate±íʾҪµ¼³öµÄÊý¾Ý¿â
> c:/hibernate ±íʾ½«Ê ......
Õâʱ¼äÔÚ°²×°PHPBBµÄÂÛ̳£¬·¢ÏÖÒ»¸öÎÊÌ⣬ÄǾÍÊÇÊäÈëÓû§Ãû¸úÃÜÂëºó£¬µã»÷°²×°£¬×ÜÊDZ¨ÁËÒÔϵĴíÎó£º
³ÌÐò´úÂë
ORA-28008: invalid old password
Cause: old password supplied is wrong; Hence user cannot be authenticated using old password
Action: Supply the correct old password for authenticatio ......
MysqlµÄ°²×°Îļþ¿ÉÒÔÖ±½Óµ½ http://www.mysql.com ÏÂÔØ£¬»ñµÃfor win32µÄ.zip°ü£¬½¨ÒéÑ¡Ôñ4.0.20d°æ±¾¡£ÕâÀï²»Ïêϸ˵Ã÷¡£
¡¡¡¡ÏÂÔØ»ñµÃMysqlµÄfor win32°²×°°üºó£¬ÓÃwinzip½âѹËõ£¬Ö±½ÓÔËÐÐsetup.exe£¬ÐèҪעÒâµÄÊÇÑ¡ÔñÒ»¸ö°²×°Â·¾¶£¬µ±È»£¬°²×°Â·¾¶¿ÉÒÔÈÎÒ⣬½¨ÒéÑ¡ÔñC:\MySQLĿ¼¡£°²×°Íê³ÉºóMySQLÒ²¾ÍÍê³ÉÁË¡£Ä¬ÈϵÄÓû ......