Infobright安装
环境:
Centos
getconf LONG_BIT
查看位数
步骤:
1、下载 http://www.infobright.org/downloads/ice/infobright-4.0.7-0-x86_64-ice.rpm
32位 http://www.infobright.org/downloads/ice/infobright-4.0.7-0-i686-ice.rpm
换到root用户:
# rpm -i infobright-4.0.7-0-x86_64-ice.rpm
rpm -i infobright-4.0.7-0-i686-ice.rpm
(32位如果报错,删除 rpm -e infobright 后,执行:yum install redhat-lsb -y)
或
(32位如果报错,删除 rpm -e infobright 后,执行:yum install nscd,然后service nscd start)
2、激活infobright
# cd /usr/local/infobright-4.0.7-x86_64; ./postconfig.sh
# cd /usr/local/infobright-4.0.7-i686; ./postconfig.sh
4、初始化数据
cd /usr/local/infobright/scripts/
./mysql_install_db --user=root --basedir=/usr/local/infobright --datadir=/usr/local/infobright/data --force
chown mysql.mysql -R /usr/local/infobright-4.0.7-x86_64/
或
cd /usr/local/infobright/scripts/
./mysql_install_db --user=root --basedir=/usr/local/infobright --datadir=/usr/local/infobright/data --force
chown mysql.mysql -R /usr/local/infobright-4.0.7-i686/
3、启动infobright
/etc/init.d/mysqld-ib start
4、设置root密码
# /usr/local/infobright-4.0.7-x86_64/bin/mysqladmin -u root password 'yvp52wgt'
/usr/local/infobright-4.0.7-i686/bin/mysqladmin -u root password 'yvp52wgt'
5、允许远程客户端通过root登录infobright
# mysql-ib -u root -p
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yvp52wgt' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
OK.
从远程机器上可以使用任意的mysql客户端访问infobright,infobright的默认端口不是3306,而是5029.
注意1:iptables 开放端口
iptables -A INPUT -p tcp --dport 5029 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 5029 -j ACCEPT
service iptables restart
再查看下 iptables -L -n 是否添加上去, 看到添加了
注意2:selinux 开放端口
b. 查看开放端口
netstat -lntp #查看监听(Listen)的端口
c. firewall 添加5029端口
firewall-cmd --permanent --add-port=5029/tcp
d. 用该命令查询是否添加成功
firewall-cmd --permanent --query-port=5029/tcp
e. firewall-cmd --reload
6.
CREATE DATABASE club_new CHARACTER SET utf8 COLLATE utf8_general_ci;
编码改成utf-8 ,避免中文为乱码。
mysql> set character_set_client =utf8;set character_set_connection =utf8;set character_set_database =utf8; set character_set_results =utf8;set character_set_server =utf8;
检测:show variables like "%char%";
7. navicat 连接之后
DROP TABLE IF EXISTS `产品表`;
CREATE TABLE `产品表` (
`id` int(10) NOT NULL,
`产品编号` varchar(10) DEFAULT NULL,
`产品名称` varchar(100) DEFAULT NULL,
`有效盒数` int(11) DEFAULT NULL,
`每盒粒数` int(11) DEFAULT NULL,
`服用天数` int(11) DEFAULT NULL,
`顺序` int(11) DEFAULT NULL,
`商品编码` varchar(15) DEFAULT NULL,
`商品类型` varchar(10) DEFAULT NULL
)DEFAULT CHARSET=utf8;
-- 3.txt 位于/usr/local/infobright-4.0.7-x86_64/data/yihaodian/下面
LOAD DATA INFILE '3.txt' INTO TABLE `产品表` FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\\';
select * from `产品表`;
8. mysql 导入数据到 infobright
mysql:
SELECT * INTO OUTFILE '/var/tmp/mdl_user.txt'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM `mdl_user`;
infobright:
DROP TABLE IF EXISTS `mdl_user`;
CREATE TABLE `mdl_user` (
....
);
LOAD DATA INFILE '/var/tmp/mdl_user.txt' INTO TABLE `mdl_user`
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n';