绑定完请刷新页面
取消
刷新

分享好友

×
取消 复制
mysql数据导入到infobright
2022-04-28 15:35:12

1 在mysql数据库上创建了表
 CREATE TABLE `t_mis` (
    -> `uid` mediumint(9) NOT NULL,
    -> `cid` smallint(6) NOT NULL,
    -> `rating` tinyint(4) NOT NULL
    -> ) ENGINE=MyISAM
    -> ;
并插入数据 :mysql> insert into t_mis (70000,3600,5),(80000,3700,2);

2 然后将数据导出CSV文件:
SELECT * from t_mis INTO OUTFILE '/tmp/mytable.csv'  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';

3 在infobright上创建表
CREATE TABLE `t_ib` (
`uid` mediumint(9) NOT NULL,
`cid` smallint(6) NOT NULL,
`rating` tinyint(4) NOT NULL
) ENGINE=BRIGHTHOUSE;

开启 /etc/init.d/mysqld-ib start

4 导入CSV到表t_ib:
LOAD DATA INFILE '/tmp/mytable.csv' INTO TABLE t_ib  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';

mysql> LOAD DATA INFILE '/tmp/mytable.csv' INTO TABLE t_ib  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
Query OK, 2 rows affected (4.26 sec)
Records: 2  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select * from t_ib;
+-------+------+--------+
| uid   | cid  | rating |
+-------+------+--------+
| 70000 | 3600 |      5 |
| 80000 | 3700 |      2 |
+-------+------+--------+
2 rows in set (0.23 sec)

分享好友

分享这个小栈给你的朋友们,一起进步吧。

Infobright
创建时间:2022-04-28 15:08:15
infobright是开源的MySQL数据仓库解决方案,引入了列存储方案,高强度的数据压缩,优化的统计计算。
展开
订阅须知

• 所有用户可根据关注领域订阅专区或所有专区

• 付费订阅:虚拟交易,一经交易不退款;若特殊情况,可3日内客服咨询

• 专区发布评论属默认订阅所评论专区(除付费小栈外)

技术专家

查看更多
  • 飘絮絮絮丶
    专家
戳我,来吐槽~