mysql最大字段数
一直对mysql最大字段数不明确有人说是1024
还有人说
Max columns per row 4096
InnoDB is limited to 1000columns
实践是检验真理的唯一方法
mysql> use test;
mysql> create table t0008(id int) engine=innodb DEFAULT CHARSET=latin1;
[root@localhost ~]# vim add.sh
#/bin/bash
num=2
while((num<2000))
do
echo $num
mysql -p123456 -D test -e "alter table t0008 add column(col$num char(1))"
num=$(($num+1))
done
[root@localhost ~]# ./add.sh
Warning: Using a password on the command line interface can be insecure.
1017
Warning: Using a password on the command line interface can be insecure.
1018
Warning: Using a password on the command line interface can be insecure.
ERROR 1117 (HY000) at line 1: Too many columns
mysql> desc t0008;
+---------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| col2 | varchar(1) | YES | | NULL | |
| col3 | varchar(1) | YES | | NULL | |
...............................................................................