本文共 3597 字,大约阅读时间需要 11 分钟。
数据库迁移可以利用数据传输服务DTS 传输。
迁移过程中会出现两个表的数据结构有问题
错误:Incorrect table definition; there can be only one auto column and it must be defined as a key
CREATE TABLE `coffee`.`pre_forum_post` ( `pid` int(10) unsigned NOT NULL COMMENT '', `fid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '', `tid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '', `first` tinyint(1) NOT NULL DEFAULT '0' COMMENT '', `author` varchar(15) CHARSET `utf8` COLLATE `utf8_general_ci` NOT NULL DEFAULT '' COMMENT '', `authorid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '', `subject` varchar(80) CHARSET `utf8` COLLATE `utf8_general_ci` NOT NULL DEFAULT '' COMMENT '', `dateline` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '', `message` mediumtext CHARSET `utf8` COLLATE `utf8_general_ci` NOT NULL COMMENT '', `useip` varchar(15) CHARSET `utf8` COLLATE `utf8_general_ci` NOT NULL DEFAULT '' COMMENT '', `port` smallint(6) unsigned NOT NULL DEFAULT '0' COMMENT '', `invisible` tinyint(1) NOT NULL DEFAULT '0' COMMENT '', `anonymous` tinyint(1) NOT NULL DEFAULT '0' COMMENT '', `usesig` tinyint(1) NOT NULL DEFAULT '0' COMMENT '', `htmlon` tinyint(1) NOT NULL DEFAULT '0' COMMENT '', `bbcodeoff` tinyint(1) NOT NULL DEFAULT '0' COMMENT '', `smileyoff` tinyint(1) NOT NULL DEFAULT '0' COMMENT '', `parseurloff` tinyint(1) NOT NULL DEFAULT '0' COMMENT '', `attachment` tinyint(1) NOT NULL DEFAULT '0' COMMENT '', `rate` smallint(6) NOT NULL DEFAULT '0' COMMENT '', `ratetimes` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '', `status` int(10) NOT NULL DEFAULT '0' COMMENT '', `tags` varchar(255) CHARSET `utf8` COLLATE `utf8_general_ci` NOT NULL DEFAULT '0' COMMENT '', `comment` tinyint(1) NOT NULL DEFAULT '0' COMMENT '', `replycredit` int(10) NOT NULL DEFAULT '0' COMMENT '', `position` int(8) unsigned NOT NULL auto_increment COMMENT '', PRIMARY KEY(`tid`,`position`), UNIQUE INDEX `pid`(`pid`), INDEX `fid`(`fid`), INDEX `authorid`(`authorid`, `invisible`), INDEX `dateline`(`dateline`), INDEX `invisible`(`invisible`), INDEX `displayorder`(`tid`, `invisible`, `dateline`), INDEX `first`(`tid`, `first`)) engine= MyISAM AUTO_INCREMENT= 1 DEFAULT CHARSET= `utf8` ROW_FORMAT= Dynamic comment= '' ;解决方案:
PRIMARY KEY(
tid
,position
), 这里把联合主键中的自增列放在联合主建的最左端
在mysql中, 若一张表里面不存在varchar、text以及其变形、blob以及其变形的字段的话,那么张这个表其实也叫静态表,即该表的row_format是fixed,就是说每条记录所占用的字节一样。其优点读取快,缺点浪费额外一部分空间。
若一张表里面存在varchar、text以及其变形、blob以及其变形的字段的话,那么张这个表其实也叫动态表,即该表的row_format是dynamic,就是说每条记录所占用的字节是动态的。其优点节省空间,缺点增加读取的时间开销。
所以,做搜索查询量大的表一般都以空间来换取时间,设计成静态表。
错误:class java.sql.SQLException:Table storage engine for ‘pre_common_member_grouppm’ doesn’t have this option
CREATE TABLE `coffee`.`pre_common_member_grouppm` ( `uid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '', `gpmid` smallint(6) unsigned NOT NULL auto_increment COMMENT '', `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '', `dateline` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '', PRIMARY KEY(`uid`, `gpmid`)) engine= MyISAM AUTO_INCREMENT= 1 DEFAULT CHARSET= `utf8` ROW_FORMAT= Fixed comment= '' ;
:
ROW_FORMAT= Fixed 删除,然后系统自动设置默认的ROW_FORMAT
如果uc_server/data/config.inc.php 这里不修改配置的话,就会报
UCenter info:
Can not connnet to Mysql server Error:Connection timed out Errno:2002