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

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

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配置。

After the make install process, we will copy over the slapd.conf file that is configured to use a SQL backend. This file is buried under the OpenLDAP ports directory in the following path:

在安装过程完毕后,我们将复制使用SQL作后台的slapd.conf文件,这个文件在openldap的ports目录的下面的路径中生成:

work/openldap-2.1.30/servers/slapd/back-sql/rdbms_depend/mysql

Change to this directory, from the ports directory of OpenLDAP, and copy the configuration file over

>; cp slapd.conf /usr/local/etc/openldap

Then we can import the back SQL file from this directory into our running MySQL server database

root@host # mysql < backsql_create.sql ldap

root@host # mysql < testdb_create.sql ldap

Optionally we can import the testdb_data and testdb_metadata files into the database so that we can have example data with which to work

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:php中文网

openldap范例数据库mysql_用mysql作openldap的后台数据库相关推荐

  1. 集成OpenLDAP与Kerberos实现统一认证(一):整合后台数据库

    文章目录 1. 写作背景 2. 既定目标 3. 环境说明 4. 安装操作 4.1 安装OpenLDAP 4.1.1 安装软件包 4.1.2 启动服务 4.1.3 初始化 4.1.4 禁止匿名访问 4. ...

  2. mysql转openldap_用mysql作openldap的后台数据库

    Setting up OpenLDAP with MySQL backend 用mysql作后台数据库安装openldap author: TBONIUS OpenLDAP is an X.500 L ...

  3. cs6 数据库mysql_能mysql内容

    PHP同时操作多个MySQL连接 <?php $con_1 = mysql_connect('localhost','root','')or die("<font color=r ...

  4. 神通数据库 mysql_sqlserver、mysql、oracle、神通数据库(oscar)、达梦(dm)各自的默认端口号...

    sqlserver默认端口号为:1433 URL=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=dbname DriverClasses ...

  5. mysql中要创建choose数据库_在MySQL中要创建choose数据库,应该使用命令“crea

    在MySQL中要创建choose数据库,应该使用命令"crea 在MySQL中要创建choose数据库,应该使用命令"createtablechoose;" 血压调节实验 ...

  6. centos7.3 mysql创建数据库_CentOS7安装MySQL及创建用户和数据库

    一.安装数据库 1 下载并安装MySQL官方的 Yum Repository [root@localhost ~]# wget -i -c http://dev.mysql.com/get/mysql ...

  7. mysql降低数据库版本_三步10分钟搞定数据库版本的降迁 (将后台数据库SQL2008R2降为SQ...

    三步10分钟搞定数据库版本的降迁 (将SQL2008R2降为SQL2005版本) 前思后想仍觉得实战数据库版本的降迁一文中的方式不仅老土而且低效,故有了下文三步搞定数据库从MSSQL2008R2 高版 ...

  8. 三步10分钟搞定数据库版本的降迁 (将后台数据库SQL2008R2降为SQL2005版本)

    三步10分钟搞定数据库版本的降迁 (将SQL2008R2降为SQL2005版本) 转载原文,并注明出处!虽无多少技术含量,毕竟是作者心血原创,希望理解. 转自 http://blog.csdn.net ...

  9. mac找不到mysql数据库_mac下mysql升级后找回丢失数据库

    昨天把mac上的mysql升级了,之前没做备份,安装完后用navicat打开以前的数据库不在了.这下悲催了. 看了官网的说明,以前的数据库文件还存在于旧的安装目录下 (/usr/local/mysql ...

最新文章

  1. 快速精确的体素GICP三维点云配准算法
  2. Windows Server 2008 R2 SP1遗忘管理员密码后的解决方案
  3. python 文件末尾增加内容_java追加内容到文件末尾
  4. 计算机网络-思维导图(6)应用层
  5. java 反射与泛型_Java基础系列 - 泛型和反射机制
  6. AutoHotKey程序防止反编译的简单手段
  7. 微信小程序运行报错---invoke event
  8. 回答嵌入式初学者的一些问题
  9. 为计算机新建一个用户,win10
  10. java中跳转页面的干法_java – 有没有一种干法来整合RowMappers的相同代码?
  11. suse linux vnc 桌面号,在SUSE Linux下安装VNC的方法
  12. django 获取 axios get 过来的数据_一起DevOps系列12django数据库创建与使用
  13. JavaScript事件
  14. 信创终端违规外联案例分析及防控措施
  15. (JS)蔚蓝网上书店(课本案例)
  16. Java 搭建srs流媒体服务器,并使用ffmpeg推流
  17. 富其云ERP学习笔记
  18. vue 商城浏览足迹_vue实现用户获取浏览记录功能
  19. 23计算机考研人第一周反思总结
  20. ios 中h5网页跳到第三方后回到项目字体变大

热门文章

  1. office2021下载|office2021安装包配置过程图文教程
  2. powermockito测试私有方法_03 增强测试: 静态、私有方法处理
  3. 西瓜视频运营策略分析:借助平台优势实现内容升级
  4. JavaScript大师必须掌握的12个知识点 1
  5. sql语句(SQL SERVER)
  6. 我在职场上的所表达出来的个性
  7. Linux应用编程之截断文件
  8. 替换mysql数据库_mysql数据库的替换
  9. Android车辆运动轨迹大数据采集最佳实践
  10. vivo在CES上展示的屏下指纹识别,能打败苹果的Face ID吗?