MySQL PAM Plugin設定
安裝 在my.cnf中設定後重開: [mysqld] plugin-load=authentication_pam.so 在Linux中設定 在/etc/pam.d中新增一個文件,名稱與服務相同(若服務為mysql檔名就叫mysql,若叫mysqld就叫mysqld) vim /etc/pam.d/mysql #%PAM-1.0 auth include password-auth account include password-auth 使用PAM來登入MySQL 如果可以讓使用都屬在mysql的群組中,不行的話就要透過proxy來mapping使用者 mysql> create user 'wang'@'127.0.0.1' IDENTIFIED WITH authentication_pam as 'mysql'; ^^^後面as 'mysql'這個就是pam.d裡面設的那個檔案名稱 記得權限要另外設定 除錯 登入時一直出現ERROR 1045 (28000): Access denied for user 'wang'@'127.0.0.1' (using password: YES),在/var/log/security中記錄: Jun 18 19:23:31 ol65 unix_chkpwd[7097]: check pass; user unknown Jun 18 19:23:31 ol65 unix_chkpwd[7099]: check pass; user unknown Jun 18 19:23:31 ol65 unix_chkpwd[7099]: password check failed for user (wang) Jun 18 19:23:31 ol65 mysqld: pam_unix(mysql:auth): authentication failure; logname= uid=496 euid=496 tty= ruser=wang rhost=127.0.0.1