emqx 5.0 使用mysql 无法做安全认证和授权

错误报告

环境

  • EMQX 版本:5.0
  • 操作系统版本: ubuntu 20

docker 部署emqx5.0 之后,想要用mysql 做认证和授权,但是看文档根本完成不了
1、文档创建的表名是mqtt_user,但是后来的配置query 是users,踩了很久的坑,还有配置不知道陪在哪里,也是花了不少的时间
2、没有查询日志,前端报错没有认证,但是后台没有相关日志,无法排查
3、沟通不畅,没有一个可以及时沟通的渠道

## NOTE:
## Configs in this file might be overridden by:
## 1. Environment variables which start with 'EMQX_' prefix
## 2. File $EMQX_NODE__DATA_DIR/configs/cluster-override.conf
## 3. File $EMQX_NODE__DATA_DIR/configs/local-override.conf
##
## The *-override.conf files are overwritten at runtime when changes
## are made from EMQX dashboard UI, management HTTP API, or CLI.
## All configuration details can be found in emqx.conf.example

node {
  name = "emqx@127.0.0.1"
  cookie = "emqxsecretcookie"
  data_dir = "data"
}

log {
  file_handlers.default {
    level = warning
    file = "log/emqx.log"
  }
}

cluster {
  name = emqxcl
  discovery_strategy = manual
}
authentication = {
  mechanism = password_based
  backend = Mysql
  enable = true

  password_hash_algorithm {
    name = sha256
    salt_position = suffix
  }

  database = emqx_user
  username = root
  password = 123456
  server = "172.26.1.152:3306"
  query = "SELECT password_hash, salt, is_superuser FROM mqtt_user where username = ${username} LIMIT 1"
}


listeners.tcp.default {
  bind = "0.0.0.0:1883"
  max_connections = 1024000

}

listeners.ssl.default {
  bind = "0.0.0.0:8883"
  max_connections = 512000
  ssl_options {
    keyfile = "etc/certs/key.pem"
    certfile = "etc/certs/cert.pem"
    cacertfile = "etc/certs/cacert.pem"
  }
}

listeners.ws.default {
  bind = "0.0.0.0:8083"
  max_connections = 1024000
  websocket.mqtt_path = "/mqtt"
}

listeners.wss.default {
  bind = "0.0.0.0:8084"
  max_connections = 512000
  websocket.mqtt_path = "/mqtt"
  ssl_options {
    keyfile = "etc/certs/key.pem"
    certfile = "etc/certs/cert.pem"
    cacertfile = "etc/certs/cacert.pem"
  }
}

# listeners.quic.default {
#  enabled = true
#  bind = "0.0.0.0:14567"
#  max_connections = 1024000
#  keyfile = "etc/certs/key.pem"
#  certfile = "etc/certs/cert.pem"
#}

dashboard {
    listeners.http {
        bind = 18083
    }
    default_username = "admin"
    default_password = "public"
}

authorization {
  deny_action = ignore
  no_match = allow
  sources =  [
    {
      type = file
      enable = true
      # This file is immutable to EMQX.
      # Once new rules are created from dashboard UI or HTTP API,
      # the file 'data/authz/acl.conf' is used instead of this one
      path = "etc/acl.conf"
    }
  ]
}

include emqx_enterprise.conf

上面是我的配置文件,求官方指导
数据库使用文档中的记录

('user123', 'bede90386d450cea8b77b822f8887065e4e5abf132c2f9dccfcc7fbd4cba5e35', 'salt', 1);

你好,问答社区就是方便大家提问和沟通的。你可以尝试开启 EMQX 的 Debug 日志来获取更多的信息,然后我看到你的配置里面是 backend = Mysql?你需要改成 backend = mysql 才对。

在dashboard配置了mysql,可以控制了