MySQL学习的一些认识笔记


MySQL也是分客户端和服务器两部分安装,当装好MySQL服务器和客户端之后就面临数据库中的表,数据库中表的结构之间的导入和导出问题,现在用过的一些SQL命令:

>MySQL -u busiusr -p 进入MySQL数据库

>set names gbk ;

MySQLdump -uroot newdrmdb tacts >tacts.sql 把库newdrmdb中的表tacts的数据导出;

source 绝对路径/*.sql 把数据导入到表中去 ;

MySQL -uroot -pheli098 < ...(绝对路径); 在linux中执行数据库的脚本 ;

select * from tmonthfees limit 1000 into outfile '/*.csv' fields terminated by ', ' ; 从tmonthfees表中导出1000条记 录到文件中 ;
load data local infile ' ' into table table_name fields terminated by ',' ; 把文件中的数据导入到表中去;

delete from tmonthfees;
delete from tusers;
delete from tusersongs;
delete from tsubscribers;

load data local infile 'C:/sql/tmonthfees.13911629339.txt' into table tmonthfees fields terminated by ',';
load data local infile 'C:/sql/tusers.13911629339.txt' into table tusers fields terminated by ',';
load data local infile 'C:/sql/tusersongs.13911629339.txt' into table tusersongs fields terminated by ',';
load data local infile 'C:/sql/tsubscribers.13911629339.txt' into table tsubscribers fields terminated by ',';

导入文本文件中的数据到数据库中的表; 

相关内容