
可以这样写:
CREATE TABLE IF NOT EXISTS `".$ctb_name."` (
`id` INT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`keyid` VARCHAR(20) NOT NULL,
`key` VARCHAR(20) NOT NULL,
`stauts` BOOL NOT NULL DEFAULT'0',
index `idx_status`(`status`)
)ENGINE = MYISAM DEFAULT CHARSET=utf8
不过,status是bool类型的字段,只有true和false,区分度太低,没有必要加索引。
索引目的是为了使查询更快,区分度小的时候不如全表扫描。
在 *** 作符命令下不能使用 运算表达式,可以使用 M,G等单位。在mysql命令行中,可以使用 运算表达式, 不可以使用M,G等单位。
例: 在OS命令下:
[mysql@localhost mysql]$ mysql --max-allowed-packet=16M -u root -p123456
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with or \g.
Your MySQL connection id is 13
Server version: 5.6.23-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
[mysql@localhost mysql]$ mysql --max-allowed-packet=16*1024*1024 -u root -p123456
Unknown suffix '*' used for variable 'max_allowed_packet' (value '16*1024*1024')
Warning: option 'max_allowed_packet': unsigned value 0 adjusted to 4096
mysql: Error while setting value '16*1024*1024' to 'max_allowed_packet'
在mysql命令行下
mysql>set global max_allowed_packet=16M
ERROR 1232 (42000): Incorrect argument type to variable 'max_allowed_packet'
mysql>set global max_allowed_packet=16*1024*1024
Query OK, 0 rows affected (0.00 sec)
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)