[转]mysql alter 语句用法,添加、修改、删除字段等
mysql alter 语句用法,添加、修改、删除字段等
//主键549830479
alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);
//增加一个新列549830479
alter table t2 add d timestamp;
alter table infos add ex tinyint not null default '0';
//删除列549830479
alter table t2 drop column c;
//重命名列549830479
alter table t1 change a b integer;
//改变列的类型549830479
alter table t1 change b b bigint not null;
alter table infos change list list tinyint not null default '0';
//重命名表549830479
alter table t1 rename t2;
加索引549830479
mysql> alter table tablename change depno depno int(5) not null; &n
相关文档:
写入时,先做encode:
public static String encode(String src) {
String result = null;
try {
result = new String(src.getBytes("gbk"), "ISO-8859-1");
} catch (UnsupportedEncodingException uee) {
System.err.println(uee);
}
return result;
}
读出时,再做decode:
public static String deco ......
1、下载MySQL的Linux安装文件
Linux下安装MySQL需要下面两个文件:
MySQL-server-5.1.7-0.i386.rpm
下载地址为:http://dev.mysql.com/downloads/mysql/5.1.html,打开此网页,下拉网页找到“Linux x86 generic RPM (statically linked against glibc 2.2.5) downloads”项,找到“Ser ......
关于MySql的导入导出问题
在终端中,进入mysql的路径下的bin中,在这个路径下可以执行mysql,mysqldump等命令。
或者添加环境变量 设置环境变量path "...(mysql的安装路径下的bin目录)",这样就不必每次都进入上面所说的路径下操作。
导出一个库:
mysqldump ......
安装配置mysql
http://edu.codepub.com/2009/1213/18710.php
一、
下载编译安装
#cd /usr/local/src/
#wget http://mysql.byungsoo.net/Downloads/MySQL-5.1/mysql-5.1.38.tar.gz
#tar –xzvf mysql-5.1.38.tar.gz ../software/
#./configure
--prefix=/usr/local/mysql //MySQL安装目录
--datadir=/mydata / ......