这篇文章主要介绍“Mysql导出导入数据的方法介绍”,在日常操作中,相信很多人在Mysql导出导入数据的方法介绍问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Mysql导出导入数据的方法介绍”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!导出数据
**直接在系统执行命令:
导出为cvs格式:[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 ‘rn’ ” –导出为txt文件时,不加lines terminated by ‘rn’ (结尾符)在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 ‘rn’; –导出为txt文件时,不加 lines terminated by ‘rn’ (结尾符)在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类型的字段,导不入数据 ???解决方法:
导入,导出时添加两个参数: fields terminated by 和 optionally enclosed bymysql> select * from name into outfile ‘/tmp/11.txt’ character set utf8 fields terminated by ‘、’ optionally enclosed by ‘”‘ ;mysql> load data infile ‘/tmp/11.txt’ into table nn character set utf8 fields terminated by ‘、’ optionally enclosed by ‘”‘ ;到此,关于“Mysql导出导入数据的方法介绍”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注云技术网站,小编会继续努力为大家带来更多实用的文章!
相关推荐: MySQL表结构怎样变更Metadata Lock
本篇文章为大家展示了MySQL表结构怎样变更Metadata Lock,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。想必玩过mysql的人对Waiting for table metadata lock肯定不会陌生,一…