一、the table is full的问题
一>You are using the MEMORY (HEAP) storage engine; in this case youneed to increase the value of the max_heap_table_size system variable. SeeSection 5.1.3,“Server System Variables”.
ERROR 1114 (HY000) at line 1720: The table 'XXXX' is full
于是就修改Mysql的配置文件my.ini,在[mysqld]下添加/修改两行:
tmp_table_size = 256M
max_heap_table_size = 256M
系统默认是16M,修改完后重启mysql
二>硬盘空间满了,清理硬盘即可.
不要被mysql的安装目录所欺骗, 最好亲自去看看数据存放目录是哪
在my.ini 搜索 datadir
看其指向的目录 就是数据存放目录。
二>ERROR1118 (42000): Row size too large. The maximum row size forthe usedtable type,not counting BLOBs,is65535. You haveto changesomecolumnstoTEXTor BLOBs
root@localhost : test10:31:01>CREATETABLE tb_test (
-> recordidvarchar(32)NOTNULL,
-> areaShowvarchar(30000)DEFAULTNULL,
-> areaShow1varchar(30000)DEFAULTNULL,
-> areaShow2varchar(30000)DEFAULTNULL,
->PRIMARYKEY (recordid)
-> ) ENGINE=INNODBDEFAULT CHARSET=utf8;
Query OK, 0 rows affected,3warnings (0.26 sec)
可以建立,只是类型被转换了。
root@localhost : test10:31:14>showwarnings;
+-------+------+----------------------------------------------------+
|Level| Code|Message |
+-------+------+----------------------------------------------------+
| Note |1246| Converting column'areaShow'fromVARCHARtoTEXT |
| Note |1246| Converting column'areaShow1'fromVARCHARtoTEXT|
| Note |1246| Converting column'areaShow2'fromVARCHARtoTEXT|
+-------+------+----------------------------------------------------+
3 rowsinset (0.00 sec)
疑问:
为什么字段小(10000)的反而报错,而大(30000)的则可以建立。为什么小的不能直接转换呢?
解决:
这里多感谢orczhou的帮助,原来MySQL在建表的时候有个限制:MySQL要求一个行的定义长度不能超过65535。具体的原因可以看:
http://dev.mysql.com/doc/refman/5.1/en/silent-column-changes.html
(1)单个字段如果大于65535,则转换为TEXT。
(2)单行最大限制为65535,这里不包括TEXT、BLOB。
按照上面总结的限制,来解释出现的现象:
第一个情况是:
单个字段长度:varchar(10000) ,字节数:10000*3(utf8)+(1 or 2) = 30000 ,小于65535,可以建立。
单行记录长度:varchar(10000)*3,字节数:30000*3(utf8)+(1 or 2) = 90000,大于65535,不能建立,所以报错:
ERROR 1118 (42000): Row size too large. The maximum row sizefor the used table type,notcounting BLOBs,is65535.You haveto changesomecolumnstoTEXTor BLOBs
第二个情况是:
单个字段长度:varchar(30000) ,字节数:30000*3+(1 or 2) = 90000 , 大于65535,需要转换成TEXT,才可以建立。所以报warnings。
单行记录长度:varchar(30000)*3,因为每个字段都被转换成了TEXT,而TEXT没有限制,所以可以建立表。
root@localhost : test10:31:14>showwarnings;
+-------+------+----------------------------------------------------+
|Level| Code|Message |
+-------+------+----------------------------------------------------+
| Note |1246| Converting column'areaShow'fromVARCHARtoTEXT |
| Note |1246| Converting column'areaShow1'fromVARCHARtoTEXT|
| Note |1246| Converting column'areaShow2'fromVARCHARtoTEXT|
+-------+------+----------------------------------------------------+