Mysql相关

来源:百度文库 编辑:神马文学网 时间:2024/04/27 14:30:19
一、备份还原 备份数据库:
备份整个表——mysqldump -h(host) -u(username) -p(password) (databasename) (tablename) > (file path and name) 。例如:mysqldump -h127.0.0.1 -uroot -proot test user > e:/user.sql;按条件备份数据表——mysqldump -h(host) -u(username) -p(password) -w "(条件)" (databasename) (tablename) > (file path and name) 。例如:mysqldump -h127.0.0.1 -uroot -proot -w "id<20" test user > e:/user.sql;  二、数据类型int(2)并不代表int最大只能是255,
int和varchar不一样,2不代表位数,代表列宽度.如果设置为2 ,到3位的话,还是会将记录插入的.虽然不影响查询,但在涉及到join的时候,可能会出现问题,具体请参看手册.

Tinyint(m) 8位整数,占用1个字节(-128~+127)
smallint(m) 16位整数,占用2个字节(-32768~+32767)
medimumint(m) 24位整数,占用3个字节(-8388608~+8388607)
int(m),integer(m) 32位整数,占用4个字节(-2147483648~+2147483647)
bigint(m) 64位整数,占用8个字节(-9.22E+18 ~ +9.22E+18)
serial 这其实是bigint auto_increment not null primary key的简写

所以你可以看到,int最大值可为2147483647  

 http://www.mysql.cn/  mysql资料库