MySQL

From Unix Wiki
Jump to: navigation, search

MySQL + LDAP

Problem description

Install MySQL server with local users authenticated via LDAP server.

Action Plan

Following action plan requires CentOS 6 distrib as base for our installation. Installation was accomplished using clean system:

  • Remove installed MySQL packages and dependencies:
service postfix stop
rpm -e mysql-libs postfix
yum install sendmail
chkconfig sendmail on
service sendmail start
  • Update system to latest version and install 'Developer Tools' group:
yum update
yum groupinstall 'Development Tools'
yum install openldap-devel
MySQL-client
MySQL-devel
MySQL-server
  • Install downloaded packages:
rpm -ivh MySQL*
tar xvpf mysql-auth_ldap-0.3.0.tar.gz
  • Configure plugin:
cd mysql-auth_ldap-0.3.0/
vi src/config.h
  • Compile and install to plugins dir (NOTE: x64 OS):
make
cp /usr/lib64/mysql/plugin/
  • Enable mysql service:
service mysql start
chkconfig mysql on
  • Add plugin to mysql configuration:
mysql> INSTALL PLUGIN auth_ldap SONAME 'auth_ldap.so';
  • Create new user and grant privileges:
mysql> CREATE USER 'user'@'localhost' IDENTIFIED WITH auth_ldap;
mysql> GRANT ALL ON dev_example1.* TO 'pavel'@'localhost';
  • Test connectivity:
mysql -u user -p
  • Clean:
cd ../
rm -rf mysql-auth_ldap-0.3.0

All set.