mysql导入excel数据乱码问题

来源:互联网 发布:宅男看片软件免费 编辑:程序博客网 时间:2024/05/29 13:22

 prerequisite

1、确保mysql字符集设置为utf8

2、先建表在导入比较好。确保每个字段的字符集设置正确。

3、导入的数据源,excel字符集也确保为统一字符集

check

导入数据后

突然发现导入的数据变成了乱码,我的情况是,导入的数据中中文都变沉了???问号
参考这篇文章中的检查方式:http://blog.csdn.net/ACMAIN_CHM/article/details/4174186
主要是这两句命令
show create table TableName 或 show full columns from tableName
1、检查建表语句的默认字符集是什么
2、假如不是你想要的字符集,设置表的字符集

show full columns from tableName
1、检查某个列的字符集格式

(此处用的是navicat)
2、假如不对的话,就设置为正确的字符集。

删除数据重新导入。(假如数据量比较大,应该先导入部分数据做测试,可以了在导入全部数据,否则不断删除、导入比较费时)


sqoop 导数据

--------------------------------

安装

参考  http://www.cnblogs.com/byrhuangqiang/p/3922594.html

 

Mysql的问题

1、  mysql  Access denied for user ‘root’@'hbase3'

解决方法 http://blog.csdn.net/lioncode/article/details/7917310

 

测试安装sqoop成功

 

sqoop list-databases --connectjdbc:mysql://192.168.0.181 --username root --password root

基本命令

参考:http://blog.csdn.net/rosen_luo/article/details/49740479

1、  hbase创建表create 'ipaddressinfo','cf'

2、  数据导入mysql中,保证mysql中有字段是主键,否则会报错

Error during import: No primary key could be found fortable ipaddressinfo. Please specify one with --split-by or perform a sequentialimport with '-m 1'.

2.5、sqoop版本兼容问题

此时遇到的问题:

http://blog.csdn.net/zwx19921215/article/details/41824853

 

 

3、  将excel数据导入mysql

注意字符格式:否则导入时候会变成  ???

https://zhidao.baidu.com/question/360722668350636652.html

4、  或者使用txt导入mysql

 

   http://blog.csdn.net/u010310183/article/details/21445643

 

5、数据导入

sqoopimport --connect jdbc:mysql://192.168.0.180:3306/test --username root--password root \

 --tableipaddressinfo --hbase-create-table --hbase-table ipaddressinfo --column-familycf --hbase-row-key StartNum 

6、mysql导入excel数据乱码问题

所有中文字段变成 ???

http://bbs.csdn.net/topics/390432551

http://blog.csdn.net/ACMAIN_CHM/article/details/4174186

http://blog.csdn.net/u010310183/article/details/21445643






0 0
原创粉丝点击