1、创建表
1.1 用户表
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for mqtt_user
-- ----------------------------
DROP TABLE IF EXISTS `mqtt_user`;
CREATE TABLE `mqtt_user` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(100) DEFAULT NULL,
`password` 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=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mqtt_user 默认一个超级用户
-- ----------------------------
INSERT INTO `mqtt_user` VALUES ('1', 'admin1', 'public1', '11', '1', '2019-08-29 10:14:43');
1.2 访问权限表
/*
Navicat MySQL Data Transfer
Source Server : 192.168.3.137_vmare
Source Server Version : 50638
Source Host : 192.168.3.137:3306
Source Database : lotdb
Target Server Type : MYSQL
Target Server Version : 50638
File Encoding : 65001
Date: 2019-08-29 11:38:10
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for mqtt_acl
-- ----------------------------
DROP TABLE IF EXISTS `mqtt_acl`;
CREATE TABLE `mqtt_acl` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`allow` int(1) DEFAULT NULL COMMENT '0: deny, 1: allow',
`ipaddr` varchar(60) DEFAULT NULL COMMENT 'IpAddress',
`username` varchar(100) DEFAULT NULL COMMENT 'Username',
`clientid` varchar(100) DEFAULT NULL COMMENT 'ClientId',
`access` int(2) NOT NULL COMMENT '1: subscribe, 2: publish, 3: pubsub',
`topic` varchar(100) NOT NULL DEFAULT '' COMMENT 'Topic Filter',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of mqtt_acl 默认一些记录
-- ----------------------------
INSERT INTO `mqtt_acl` VALUES ('1', '1', null, '$all', null, '2', '#');
INSERT INTO `mqtt_acl` VALUES ('2', '0', null, '$all', null, '1', '$SYS/#');
INSERT INTO `mqtt_acl` VALUES ('3', '0', null, '$all', null, '1', 'eq #');
INSERT INTO `mqtt_acl` VALUES ('5', '1', '127.0.0.1', null, null, '2', '$SYS/#');
INSERT INTO `mqtt_acl` VALUES ('6', '1', '127.0.0.1', null, null, '2', '#');
INSERT INTO `mqtt_acl` VALUES ('7', '1', null, 'dashboard', null, '1', '$SYS/#');