现在的位置: 首页 > 综合 > 正文

MYSQL使用笔记(1)

2017年12月20日 ⁄ 综合 ⁄ 共 736字 ⁄ 字号 评论关闭

创建用户 用户名 dnsexpuser  密码:dnsexp1347
insert into mysql.user(Host,User,Password) values ('localhost','dnsexpuser',password('dnsexp1347')) ;

创建数据库  
分配数据库权限
create database  wap_tagdb ;
grant all privileges on wap_tagdb.*to waptag@localhost identified by '123123' ;

增加表字段 alter   table   表名   add   字段   类型
    alter table wap_host_old add flag int(2) not null default 0 ;

删除表中字段
    alter table wap_host_old drop column flag

从文件里导入数据

load data infile '/tmp/tt.txt' into table wap_subtag fields terminated by '/t' enclosed by '' lines terminated by '/n' IGNORE 1 LINES (subtag_id,subtag_name);

查询导出到文件里
select host,sys_toptag,sys_subtag,new_toptag,new_subtag,date_format(FROM_UNIXTIME(modtime),'%Y-%m-%d')  into outfile '/tmp/log20110105.txt'  fields terminated by '/t' optionally enclosed by '' lines terminated by '/n'  from wap_log ;

抱歉!评论已关闭.