使用mod_auth_mysql.so

时间:2022-06-26 16:54:38

CREATE TABLE users (
id int(14) NOT NULL auto_increment,
user_name CHAR(30) NOT NULL,
user_passwd CHAR(20) NOT NULL,
created timestamp(14) NOT NULL,
updated timestamp(14) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY user_name (user_name)
);
CREATE TABLE groups (
id int(14) NOT NULL auto_increment,
user_name CHAR(30) NOT NULL,
user_group CHAR(20) NOT NULL,
created timestamp(14) NOT NULL,
updated timestamp(14) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY user_name (user_name,user_group)
);

INSERT INTO users(user_name,user_passwd) VALUES ('wangsong', ENCRYPT('123456'));
select * from users;
INSERT INTO groups(user_name,user_group) VALUES ('wangsong', 'test');
select * from groups;

AuthName "MySQL group authenticated zone"
AuthType Basic

AuthMYSQLEnable on
AuthMySQLUser root
AuthMySQLPassword 123456
AuthMySQLDB git
AuthMySQLUserTable users
AuthMySQLNameField user_name
AuthMySQLPasswordField user_passwd
AuthMySQLGroupTable groups
AuthMySQLGroupField user_group