-
Notifications
You must be signed in to change notification settings - Fork 0
MySQL MariaDB SQL
SET NAMES utf8; SET time_zone = '+00:00'; SET foreign_key_checks = 0;
SET NAMES utf8mb4;
DROP TABLE IF EXISTS
groups
; CREATE TABLEgroups
(groupname
varchar(30) NOT NULL,gid
int(11) NOT NULL,members
varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;DROP TABLE IF EXISTS
login_history
; CREATE TABLElogin_history
(userid
varchar(30) NOT NULL,client_ip
varchar(500) NOT NULL,server_ip
varchar(500) NOT NULL,protocol
varchar(500) NOT NULL,login_date
datetime NOT NULL, KEYuser
(userid
), CONSTRAINTlogin_history_ibfk_1
FOREIGN KEY (userid
) REFERENCESusers
(userid
) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;DROP TABLE IF EXISTS
users
; CREATE TABLEusers
(userid
varchar(30) NOT NULL,passwd
varchar(80) NOT NULL,uid
int(11) DEFAULT NULL,gid
int(11) DEFAULT NULL,homedir
varchar(255) DEFAULT NULL,shell
varchar(255) DEFAULT NULL,last_accessed
timestamp NULL DEFAULT NULL, UNIQUE KEYuserid
(userid
), UNIQUE KEYuid
(uid
) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;