My intention is to make a MySQL table of Customer Contact Information available to Outlook/Thunderbird clients as an Address Book (via LDAP).

I'm aware that OpenLDAP has a MySQL backend option, but I haven't been able to find any clear, solid documentation on how to configure it.

Which OpenLDAP options do I need to set, and where do I go to set them?

I'm running Ubuntu 9.04.


I've got the ODBC files setup, and the test data imported to the database, but still no idea how to configure slapd to use the database. Somewhere, in some config file, I have to say "slapd, use the ODBC resource called 'LDAP2MySQL'". But where? And how?


I'm getting nowhere with this:

The Ubuntu package version didn't have SQL support after all, so I removed it, and I am trying to install from source.

I think it installed ok, but "make test" produces the error "Comparison failed. ./scripts/test003-search failed (exit 1)".

I did a "make install" anyway, since Google didn't seem to have any explanation on how to fix the "comparison failed" problem.

Now I can't even start the stupid thing. "/etc/init.d/slapd start", which worked with Ubuntu's package, doesn't work. The openLDAP manual says "/usr/local/libexec/slapd" is the command to start it. ...But that command produces no output. I don't even know if it's running or not. I give up.


Ok, I ran "top | grep slapd" and I get nothing, so I guess it's not running. But no error messages. So, what? I have to guess why it won't start?


I've reinstalled the operating system and am starting from a clean slate. Now I can't even ./configure openldap because it can't find db.h. The package "db4.7-util" is installed. The harder I try to make this work, the less it works. I can't believe that no one knows how to do this.


I just installed BerkeleyDB from source, and yet the OpenLDAP compiler still says:

    checking for db.h... no
    configure: error: BDB/HDB: BerkeleyDB not available

One site sugguested I try:

    export CPPFLAGS="-I/usr/local/berkeleydb/include"
   export LDFLAGS="-L/usr/local/berkeleydb/lib"

But that didn't work either.


OK. I FINALLY got it to compile.

I had to use:

CPPFLAGS="-I/usr/local/berkeleydb/include -D_GNU_SOURCE" export CPPFLAGS

LDFLAGS="-L/usr/local/lib -L/usr/local/berkeleydb/lib -R/usr/local/berkeleydb/lib" export LDFLAGS

LD_LIBRARY_PATH="/usr/local/berkeleydb/lib" export LD_LIBRARY_PATH

./configure --enable-sql 

Now I'm facing another problem. When I run "make test", it hangs forever on:

>>>>> Starting test001-slapadd ...
running defines.sh
Running slapadd to build slapd database...

Apparently I'm supposed to install two patches to fix this, but haven't been having much luck. I think I found one of them, but I have no idea how to apply it.

  • Why not add the entries to the LDAP right away?
    – rkthkr
    Aug 13, 2009 at 8:53
  • Because they're already in a MySQL database.
    – Nick
    Aug 13, 2009 at 9:13
  • Pointing LDAP at the database is described in the slapd-sql man page. Basically there are a series of options you'll add to the section of our slapd.conf that describes the SQL backend. You'll setup the necessary DB credentials, then a series of config options that describe the SQL queries necessary to use your DB.
    – Insyte
    Aug 14, 2009 at 6:40

1 Answer 1


The OpenLDAP Admin Guide seems to walk through the setup in a pretty clear fashion. And man 5 slapd-sql appears to be thorough and complete.

  • The OpenLDAP Guide seems to be PostgreSQL specific. I don't have a "/usr/lib/libodbcpsql.so" file on my computer. I'm assuming I need to specify a different .so file for MySQL? Which one?
    – Nick
    Aug 13, 2009 at 10:30
  • 1
    The back_sql backend uses ODBC (specifically the unixodbc package) to manage its SQL connections. So the only changes you should need to make to get it working with MySQL are in the /etc/odbinst.ini file. The information you need to get that working should be available here: unixodbc.org/odbcinst.html
    – Insyte
    Aug 13, 2009 at 10:47
  • I read through the document, and it confirms that the "libodbcpsql.so" driver file is Postgre specific, but it doesn't say which driver (.so) file I should use in odbcinst.ini for a MySQL database.
    – Nick
    Aug 14, 2009 at 3:56
  • 1
    It look likes the ODBC driver files are in "/usr/lib/odbc/" on Ubuntu. And if anyone else is wondering, the correct files are "libmyodbc.so" for the driver and "libodbcmyS.so" for setup. I'll post back and let you know if it works. Thanks!
    – Nick
    Aug 14, 2009 at 4:16
  • More info on why a RDBMS is not such a great idea: openldap.org/faq/data/cache/378.html
    – jeremiah
    Jul 21, 2012 at 11:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .