I would like to configure my session logs in PAM to be administered in an external MySQL server.
Follow the below steps:
1) Install MySQL in a server.
Note: Ensure port 3306 is open between PAM and the MySQL Server.
2) Connect to MySQL in the external server and create the database.
mysql> create database <Database Name>;
3) Grant privileges to the db user that is going to connect to the database from PAM:
mysql> GRANT ALL PRIVILEGES ON *.* TO [email protected]'<PAM Hostname>' IDENTIFIED BY '<your password>' WITH GRANT OPTION;
[OR mysql>GRANT ALL PRIVILEGES ON *.* TO [email protected]'%' IDENTIFIED BY '<your password>' WITH GRANT OPTION;]
mysql> FLUSH PRIVILEGES;
4) Login to PAM and go to:
5) Click on Update. You should get the following message:
6) Connect to your database and verify that tables get created:
mysql>use <Database Name>;
mysql>show tables;
Eg: my <Database Name> is logpam
PAM DB Version 3.x:
mysql Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using EditLine wrapper
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.21-log MySQL Commercial Server (Advanced)
Protocol version: 10
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4