1. 使用apt-get安装php5相关的主要软件,下面的安装内容都是以此为基础的
  2. apt-get install sqlrelay
  3. apt-get install sqlrelay-mysql
  4. apt-get install php5-sqlrelay
  5. 配置sqlrelay配置文件:/etc/sqlrelay/sqlrelay.conf
  6. 配置sqlrelay的instances文件:/etc/sqlrelay/instances
  7. 添加sqlrelay在php5下的配置文件:/etc/php5/conf.d/sqlrelay.ini:extension=sql_relay.so
  8. 重启php5-cgi
  9. 启动sqlrelay:/etc/init.d/sqlrelay start

文件sqlrelay.conf:
[codesyntax lang="xml"]

<?xml version="1.0"?>
<!DOCTYPE instances SYSTEM "sqlrelay.dtd">
<instances>
        <instance id="pvzs" port="9191" socket="/tmp/pvzs.socket" dbase="mysql" connections="100" maxconnections="100" maxqueuelength="0" growby="10" ttl="60" endofsession="commit"
sessiontimeout="60" cursors="0" authtier="listener" handoff="pass">
                <users>
                        <user user="sladmin" password="123"/>
                </users>
                <connections>
                        <connection connectionid="pvzscon" string="host=127.0.0.1;port=3306;user=root;password=123;db=pvzs" metric="1"/>
                </connections>
        </instance>
</instances>

[/codesyntax]
文件instances:
[codesyntax lang="bash"]

pvzs /etc/sqlrelay/sqlrelay.conf

[/codesyntax]