[转]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
相关文档:
Some problems encounted this afternoon, when trying to setup/test mysql capabilities on hypnos and virgil.
1.ERROR 2003 (HY000): Can't connect to MySQL server on 'server-name' (111)
access locally (i.e. from localhost) is fine, when trying remotely got this error. when tried with mysql++ library, ......
昨天要mysql中写存储过程发现网上有关于cursor循环且套的资料很少,现发出本人写的例子,希望能对大家有帮助.
看招:
DELIMITER $$
USE `ad_db`$$
DROP PROCEDURE IF EXISTS `test`$$
CREATE DEFINER=`root`@`%` PROCEDURE `test`()
BEGIN
/** CPA效果数 */
DECLARE _tmpId1 INT;
DECLARE ......
用mysql_query,mysql_fetch_array()后应该要
free_result().function count_admin($where = '')
{
if($where) $where = " WHERE $where";
$result = $this->db->get_one("SELECT count(*) as num from $this->table_admin_role $where");
return $result['num'];
} ......
关于MySql的导入导出问题
在终端中,进入mysql的路径下的bin中,在这个路径下可以执行mysql,mysqldump等命令。
或者添加环境变量 设置环境变量path "...(mysql的安装路径下的bin目录)",这样就不必每次都进入上面所说的路径下操作。
导出一个库:
mysqldump ......
MySQL数据库备份和还原的常用命令
原文见http://www.21andy.com/blog/20071102/655.html
时间:2007-11-02 23:29:09 类别:技术 访问:3,731 views RSS 2.0 评论
备份MySQL数据库的命令
mysqldump -hhostname -uusername -ppassword database ......