2010.01.14 (mysql: data too long for column)
netbeans6.7ÖÐÏòmysql5ÖвåÈëÖÐÎÄÊý¾ÝʱÏÔʾ”data too long for column“µÄÎÊÌâ¡£
ÎÒµÄmysqlÖÐ×Ö·ûµÄÉèÖÃʱutf-8£¬²¢ÇÒÔÚ¿ØÖÆ̨ÖпÉÒÔ²åÈëÖÐÎÄÊý¾Ý²¢ÏÔʾ£¬µ«ÔÚnetbeansÖвåÈëÊý¾Ýʱȴ×ÜÊÇÏÔʾ”data too long for column“¡£»ù±¾¿ÉÒÔÅжÏÊÇÓÉÓÚnetbeansºÍmysqlÖ®¼äµÄÊý¾Ý½»»»³öÁËÎÊÌâ¡£ºóÀ´ÔÚMySQL GUI ToolsÀïÃæÉú³ÉÒ»¸ö±í£¬²é¿´Á˽¨±íµÄsqlÓï¾äºó£¬·¢ÏÖÀïÃæ¶àÁËÒ»¾ä”CHARACTER SET utf8;“£¬ÊÔÁËһϣ¬ÔÚnetbeansÀïÖÕÓÚ¿ÉÒÔ²åÈëÖÐÎÄÊý¾ÝÁË¡£
¸½£º³É¹¦Ö´ÐеÄsqlÓï¾ä¡£
CREATE TABLE `grasspubsys`.`linkclass` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`info` VARCHAR(100) NOT NULL,
`time` TIMESTAMP NOT NULL,
PRIMARY KEY (`id`)
)CHARACTER SET utf8;
Ïà¹ØÎĵµ£º
PERCONA PERFORMANCE CONFERENCE 2009ÉÏ£¬À´×ÔÑÅ»¢µÄ¼¸Î»¹¤³Ìʦ´øÀ´ÁËһƪ”Efficient Pagination Using MySQL“µÄ±¨¸æ£¬ÓкܶàÁÁµã£¬±¾ÎÄÊÇÔÚÔÎÄ»ù´¡ÉϵĽøÒ»²½ÑÓÉì¡£
Ê×ÏÈ¿´Ò»Ï·ÖÒ³µÄ»ù±¾ÔÀí£º
mysql> explain SELECT * from message ORDER BY id DESC LIMIT 10000, 20\G
***************** 1. row ** ......
Mysql£¬SqlServer£¬OracleÖ÷¼ü×Ô¶¯Ôö³¤µÄÉèÖÃ
1¡¢°ÑÖ÷¼ü¶¨ÒåΪ×Ô¶¯Ôö³¤±êʶ·ûÀàÐÍ
ÔÚmysqlÖУ¬Èç¹û°Ñ±íµÄÖ÷¼üÉèΪauto_incrementÀàÐÍ£¬Êý¾Ý¿â¾Í»á×Ô¶¯ÎªÖ÷¼ü¸³Öµ¡£ÀýÈ磺
create table customers(id int auto_increment primary key not null, name varchar(15));
insert into customers(name) values("name1"),("nam ......
Ò»¡¢MySQL5.1°²×°
´ò¿ªÏÂÔصݲװÎļþ£¬³öÏÖÈçϽçÃ棺
mysql°²×°Ïòµ¼Æô¶¯£¬µã»÷“next”¼ÌÐø
Ñ¡Ôñ°²×°ÀàÐÍ£¬ÓГTypical£¨Ä¬ÈÏ£©”¡¢“Complete£¨ÍêÈ«£©”¡¢“Custom£¨Óû§×Ô¶ ......
¹ØÓÚMySQLÊÂÎñ´¦Àíѧϰ¼Ç
START TRANSACTION, COMMITºÍROLLBACKÓï·¨
START TRANSACTION | BEGIN [WORK]
COMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]
ROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]
SET AUTOCOMMIT = {0 | 1}
START
TRANSACTION»òBEGINÓï¾ä¿ÉÒÔ¿ªÊ¼Ò»ÏîеÄÊÂÎñ¡£COMMIT¿ÉÒÔÌá½»µ±Ç°ÊÂÎñ ......