1.MySql配置密码认证
CREATE TABLE `mqtt_user` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(100) DEFAULT NULL,
`password_hash` varchar(100) DEFAULT NULL,
`salt` varchar(35) DEFAULT NULL,
`is_superuser` tinyint(1) DEFAULT 0,
`created` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `mqtt_username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2.MySql配置授权认证
CREATE TABLE `mqtt_acl` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(100) NOT NULL,
`permission` varchar(5) NOT NULL,
`action` varchar(9) NOT NULL,
`topic` varchar(100) NOT NULL,
`qos` tinyint(1),
`retain` tinyint(1),
INDEX username_idx(username),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
3.常用命令
默认账户密码:admin public
admins add <Username> <Password> <Tags> 创建 admin 账号
admins passwd <Username> <Password> 重置 admin 密码
admins del <Username> 删除 admin 账号
评论区