데이터 베이스 MySQL 튜토리얼 用mysql作openldap的后台数据库

用mysql作openldap的后台数据库

Jun 07, 2016 pm 04:16 PM
mysql 무대 뒤에서 데이터 베이스

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

  root@host # mysql

  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

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
2 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
2 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

PHP에서 MySQL 백업 및 복원을 사용하는 방법은 무엇입니까? PHP에서 MySQL 백업 및 복원을 사용하는 방법은 무엇입니까? Jun 03, 2024 pm 12:19 PM

PHP에서 MySQL 데이터베이스를 백업하고 복원하는 작업은 다음 단계에 따라 수행할 수 있습니다. 데이터베이스 백업: mysqldump 명령을 사용하여 데이터베이스를 SQL 파일로 덤프합니다. 데이터베이스 복원: mysql 명령을 사용하여 SQL 파일에서 데이터베이스를 복원합니다.

PHP에서 MySQL 쿼리 성능을 최적화하는 방법은 무엇입니까? PHP에서 MySQL 쿼리 성능을 최적화하는 방법은 무엇입니까? Jun 03, 2024 pm 08:11 PM

선형 복잡성에서 로그 복잡성까지 조회 시간을 줄이는 인덱스를 구축하여 MySQL 쿼리 성능을 최적화할 수 있습니다. SQL 삽입을 방지하고 쿼리 성능을 향상하려면 PREPAREDStatements를 사용하세요. 쿼리 결과를 제한하고 서버에서 처리되는 데이터의 양을 줄입니다. 적절한 조인 유형 사용, 인덱스 생성, 하위 쿼리 사용 고려 등 조인 쿼리를 최적화합니다. 쿼리를 분석하여 병목 현상을 식별하고, 캐싱을 사용하여 데이터베이스 로드를 줄이고, 오버헤드를 최소화합니다.

PHP를 사용하여 MySQL 테이블에 데이터를 삽입하는 방법은 무엇입니까? PHP를 사용하여 MySQL 테이블에 데이터를 삽입하는 방법은 무엇입니까? Jun 02, 2024 pm 02:26 PM

MySQL 테이블에 데이터를 삽입하는 방법은 무엇입니까? 데이터베이스에 연결: mysqli를 사용하여 데이터베이스에 대한 연결을 설정합니다. SQL 쿼리 준비: 삽입할 열과 값을 지정하는 INSERT 문을 작성합니다. 쿼리 실행: query() 메서드를 사용하여 삽입 쿼리를 실행하면 확인 메시지가 출력됩니다.

PHP에서 MySQL 저장 프로시저를 사용하는 방법은 무엇입니까? PHP에서 MySQL 저장 프로시저를 사용하는 방법은 무엇입니까? Jun 02, 2024 pm 02:13 PM

PHP에서 MySQL 저장 프로시저를 사용하려면: PDO 또는 MySQLi 확장을 사용하여 MySQL 데이터베이스에 연결합니다. 저장 프로시저를 호출하는 문을 준비합니다. 저장 프로시저를 실행합니다. 결과 집합을 처리합니다(저장 프로시저가 결과를 반환하는 경우). 데이터베이스 연결을 닫습니다.

PHP를 사용하여 MySQL 테이블을 만드는 방법은 무엇입니까? PHP를 사용하여 MySQL 테이블을 만드는 방법은 무엇입니까? Jun 04, 2024 pm 01:57 PM

PHP를 사용하여 MySQL 테이블을 생성하려면 다음 단계가 필요합니다. 데이터베이스에 연결합니다. 데이터베이스가 없으면 작성하십시오. 데이터베이스를 선택합니다. 테이블을 생성합니다. 쿼리를 실행합니다. 연결을 닫습니다.

MySQL 8.4에서 mysql_native_password가 로드되지 않음 오류를 수정하는 방법 MySQL 8.4에서 mysql_native_password가 로드되지 않음 오류를 수정하는 방법 Dec 09, 2024 am 11:42 AM

MySQL 8.4(2024년 최신 LTS 릴리스)에 도입된 주요 변경 사항 중 하나는 "MySQL 기본 비밀번호" 플러그인이 더 이상 기본적으로 활성화되지 않는다는 것입니다. 또한 MySQL 9.0에서는 이 플러그인을 완전히 제거합니다. 이 변경 사항은 PHP 및 기타 앱에 영향을 미칩니다.

iOS 18에는 손실되거나 손상된 사진을 검색할 수 있는 새로운 '복구된' 앨범 기능이 추가되었습니다. iOS 18에는 손실되거나 손상된 사진을 검색할 수 있는 새로운 '복구된' 앨범 기능이 추가되었습니다. Jul 18, 2024 am 05:48 AM

Apple의 최신 iOS18, iPadOS18 및 macOS Sequoia 시스템 릴리스에는 사진 애플리케이션에 중요한 기능이 추가되었습니다. 이 기능은 사용자가 다양한 이유로 손실되거나 손상된 사진과 비디오를 쉽게 복구할 수 있도록 설계되었습니다. 새로운 기능에는 사진 앱의 도구 섹션에 '복구됨'이라는 앨범이 도입되었습니다. 이 앨범은 사용자가 기기에 사진 라이브러리에 포함되지 않은 사진이나 비디오를 가지고 있을 때 자동으로 나타납니다. "복구된" 앨범의 출현은 데이터베이스 손상으로 인해 손실된 사진과 비디오, 사진 라이브러리에 올바르게 저장되지 않은 카메라 응용 프로그램 또는 사진 라이브러리를 관리하는 타사 응용 프로그램에 대한 솔루션을 제공합니다. 사용자는 몇 가지 간단한 단계만 거치면 됩니다.

PHP에서 MySQLi를 사용하여 데이터베이스 연결을 설정하는 방법에 대한 자세한 튜토리얼 PHP에서 MySQLi를 사용하여 데이터베이스 연결을 설정하는 방법에 대한 자세한 튜토리얼 Jun 04, 2024 pm 01:42 PM

MySQLi를 사용하여 PHP에서 데이터베이스 연결을 설정하는 방법: MySQLi 확장 포함(require_once) 연결 함수 생성(functionconnect_to_db) 연결 함수 호출($conn=connect_to_db()) 쿼리 실행($result=$conn->query()) 닫기 연결( $conn->close())

See all articles