> 数据库 > MySQL >

用mysql作openldap的后台数据库(2)

Host = localhost
ServerType = MySQL
Port = 3306
FetchBufferSize = 99
User = ldap
Password = password
Database = ldap
ReadOnly = no
Socket = /tmp/mysql.sock

[ODBC]
InstallDir=/usr/local/lib

Again, substitute password for the actual password we created for the ldap user of the MySQL database.
再次,为我们在mysql数据库建立的ldap用户的密码。

We can test our current configuration before installing and configuring OpenLDAP. LibIODBC provides a test utility to check DSN configurations.
在安装配置openldap以前,我们可以测试我们当前的配置。LibIODBC提供了检测DSN配置的测试工具。

Note from darxpryte: Upon following this tutorial I've found that iodbctest was not built automatically. This may be fixed later but if you find this to be the case you'll need to do the following:
darxpryte提示:在这篇指南的下面,我发现iodbctest没有自动建立,以后或许会修正这个问题,不过如果你需要如此的话,按照修面的操作:

cd /usr/ports/databases/libiodbc/
make extract
cd work/libiodbc-3.52.2/samples
make install

This will install iodbctest into /usr/local/bin/
这将把iodbctest安装到/usr/local/bin/

Once you install iodbctest, you can do the following to test your connection:
一旦你安装了iodbctest,你就可以安装下面的方法来测试你的连接:

root@host # iodbctest
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.51.0001.0908

Enter ODBC connect string (? shows list): ?

DSN | Description
---------------------------------------------------------------
ldap | MySQL LDAP DSN

Enter ODBC connect string (? shows list):DSN=ldap
Driver: 03.51.06

SQL>;show tables;

Tables_in_ldap
---------------------
authors_docs
documents
institutes
ldap_attr_mappings
ldap_entries
ldap_entry_objclasses
ldap_oc_mappings
ldap_referrals
persons
phones

result set 1 returned 10 rows.

This shows us that the DSN is configured correctly for LibIODBC to use the MyODBC driver in order to connect to our ldap database we set up on our MySQL Server
这表示,DSN已经为LibIODBC配置好使用MyODBC驱动,好用来连接到我们在mysql服务器上安装的ldap数据库。

If you have problems displaying the DSN names defined in the odbc.ini file via the test program, try exporting the following shell environmental variable:
如果你通过测试程序时有问题(显示定义在odbc.ini里面的DSN名字),尝试输入下面的shell环境变量:

For csh or tcsh:
对于csh或者tcsh:

setenv ODBCINI /usr/local/etc/libiodbc/odbc.ini

For sh or bash:
对于sh或者bash:

export ODBCINI=/usr/local/etc/libiodbc/odbc.ini

Configuring OpenLDAP to use MySQL
配置openldap使用mysql

During the build of OpenLDAP, we need to pass the WITH_ODBC="YES" option so that the server build the appropriate SQL configurations
在编译openldap的时候,我们需要跳过 WITH_ODBC="YES"选项,这样,服务器编译专用的sql配置。



(责任编辑:IT)