---
title: "inforbright使用"
author: "conkeyn"
date: "2010-10-20T09:44:30Z"
tags: []
categories: ["数据库"]
slug: "inforbright"
draft: false
lastmod: "2010-10-22T17:25:52Z"
id: 789188
url: "https://conkeyn.iteye.com/blog/789188"
---

### **环境要求**

32位的infobright需要1GB的内存，2GB的虚拟内存。

### **安装命令**

执行“rpm -ivh infobright-3.3.1-i686-ice.rpm”即可执行安装了。如果提示内存过小而无法安装，而、就需要使用“rpm -q infobright”查询已经装在系统里头的是什么版本的inforbright，然后再使用“rpm -e infobright-3.3.1-0”执行删除。

### **导出/导入数据**

把mysql的MyISAM引擎的表导出到文件一定需要用到以下格式才能让BRIGHTHOUSE引擎识别到。

```
use dist_37;
SELECT * into outfile 'cust_gather_type_58_20100425.TXT'
FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\'
FROM cust_gather_type_58_20100425;




```

 

使用

```
use dist_37;
load data infile '/cust_gather_type_58_20100425.TXT' 
into table cust_gather_type_58_20100425 
FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\';




```

 

将数据入表中。  
BRIGHTHOUSE引擎需要增加 **FIELDS** 后面的命令参数。

### 使用PHP连接infobright

```
<?php
$linker = mysql_pconnect("127.0.0.1","****","*******");
$rs = mysql_query("show databases",$linker);
while ($row = mysql_fetch_assoc($rs))
{
    echo "{$row["Database"]}\n";
}




```

 

此时需要注意的是，在连接infobright安装的数据库连接时，你不能使用“localhost”，只能使用IP地址进行连接。

- 在服务器本机的PHP程序访问infobright时，若使用localhost为会连接地址，侧PHP会认为使用mysql的默认 socket方式，但是我们没有安装mysql，那么会报错。
  
  ```
  ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
  
  
  
  
  ```
- 应用采用IP地址进行连接（个人理解为使用TCP/IP协议？）。
  
  **mysql and it’s clients may use use “localhost” in a special manner on a linux machine;**  
  **it may try to use the default “socket file” to connect, even if given a port number.**  
  **in php this is configured somewhere;**  
  **if you want to NOT use the socket file, try using the IP address, or hostname instead of “localhost” in your connect string.**  
  **that may work.**  
  **The second thing to check is if you have granted permission to connect, by default it may not be enabled.**  
  **you use the “grant” mysql command.**  
  **tw**