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)