时间:2021-07-01 10:21:17 帮助过:41人阅读
[root@slave ~]# mysql -u root -p密码 -e "select * from mydb.name into outfile ‘/tmp/12.cvs‘ character set utf8" --character set utf8 指定相应编码规则,不然可能乱码
导出为txt格式:
[root@slave ~]# mysql -u root -p密码 -e "select * from mydb.name into outfile ‘/tmp/12.txt‘ character set utf8 lines terminated by ‘\r\n‘ " --导出为txt文件时,不加lines terminated by ‘\r\n‘ (结尾符)在windows下会像一团麻一样.....
在mysql内:
导出为cvs格式:
mysql>selec t * from mydb.name into outfile ‘/tmp/12.cvs‘ character set utf8; - --character set utf8 指定相应编码规则,不然可能乱码
导出为txt格式:
mysql> select * from mydb.name into outfile ‘/tmp/12.txt‘ character set utf8 lines terminated by ‘\r\n‘; --导出为txt文件时,不加 lines terminated by ‘\r\n‘ (结尾符)在windows下会像一团麻一样.....
导出为cvs格式后,用WPS打开,相当的完美!
导入数据
mysql内导入:
mysql>load data infile ‘/tmp/12.txt‘ into table name character set uft8; --character set utf8 指定相应编码规则,不然可能乱码
直接在系统执行命令:
[root@slave ~]# mysql -u root -p密码 -e load data infile ‘/tmp/12.txt‘ into table name character set uft8; --character set utf8 指定相应编码规则,不然可能乱码
遇到一个问题:emun类型的字段,导不入数据 ???
Mysql导出/导入数据
标签:mysql 导入导出