用mysql作openldap的后台数据库
2013-01-15 15:57:53 来源:WEB开发网 Setting up OpenLDAP with MySQL backend
用mysql作后台数据库安装openldap
author: TBONIUS
OpenLDAP is an X.500 Lightweight Directory Access Server used for
centralized authentication and directory lookups. This article covers configuring this service to utilize SQL services in order to store its data object. Having these objects stored in a SQL database allow for third party applications access to manage these objects.
openldap是一个基于x.500协议用来集中认证和目录搜索的级目录访问服务器。这篇文章包含的内容是:利用sql服务来配置这个服务器 ,用来保存对象和数据。允许第三方应用访问、管理这些保存在SQL数据库里的对象。
Ports that are needed:
需要的ports有:
MySQL 4.x server : /usr/ports/databases/mysql41-server
MySQL 4.x client : /usr/ports/databases/mysql41-client
LibIODBC 3.x : /usr/ports/databases/libiodbc
MyODBC 3.x : /usr/ports/databases/myodbc
OpenLDAP 2.x : /usr/ports/databases/openldap21-server WITH_ODBC="YES"
Configuring the MySQL server
配置mysql服务器
OpenLDAP has the option to use many different kinds of databases, in this case we will use MySQL. The first step in setting this up is to create a MySQL database for which OpenLDAP will use.
openldap可选很多不同种类的数据库。在这种情况下,我将使用mysql。要完成这个任务的第一步是建立一个openldap将要使用的mysql数据库
root@host # mysqladmin create ldap
Next we will create a MySQL account that OpenLDAP will use for our newly created ldap database
下面我将建立一个openldap会用的mysql帐号,对应我们新建立的ldap数据库。
root@host # mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10 to server version: 4.0.18
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>;grant all privileges on ldap.* to 'ldap'@'localhost'
->;identified by 'password' with grant option;
Query OK, 0 rows affected (0.13 sec)
We of course want to substitute 'password' with the actual password we wish to use for this particular user account
对特定的用户帐号,我们当然想用我们真正想用的密码替换'password'。
Configuring LibIODBC to use the MyODBC driver
配置LibODBC使用MyODBC驱动。
Quite simply we need to edit two file here to get LibODBC to use the MyODBC driver in accessing the MySQL server.
事实上我们只需要简单得修改这里的两个文件就可让LibODBC使用MyODBC驱动来访问MySQL服务器。
Take a look at the /usr/local/etc/libiodbc/odbcinst.ini file and make the following changes
看看这个文件/usr/local/etc/libiodbc/odbcinst.ini并修改内容:
[ODBC Drivers]
MySQL = Installed
[MySQL]
Description=ODBC for MySQL
Driver=/usr/local/lib/libmyodbc3.so
Take a look at the /usr/local/etc/libiodbc/odbc.ini and make the following changes
看看这个文件/usr/local/etc/libiodbc/odbc.ini并作如下修改:
[ODBC Data Sources]
ldap = MySQL LDAP DSN
[ldap]
Driver = /usr/local/lib/libmyodbc3.so
Description = OpenLDAP Database