future2012lg

博客园 首页 新随笔 联系 订阅 管理

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)

posted on 2013-04-26 22:13  future2012lg  阅读(732)  评论(0编辑  收藏  举报