2017-06-22 14:52



I would like to set up an own Mosquitto broker as a docker container. This is not a problem since there are several ready to run containers out there.

My problem is, how can i configure mosquitto in a way, that i can store the user login credentials, for authentication against mosquitto, in a Database like mysql instead of a password file.

The background is, i would like to configure the access by a PHP script. Im open to other methods instead of using a mysql db.

But i think a db would be the best solution. Im also open to alternatives to Mosquitto. I only would like to use MQTT with a DB based user authentication.


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • drtiwd06558 drtiwd06558 4年前

    I have a Dockerfile that will build a container with both Mosquitto and the authentication plugin ( In my case I set it up to work against a instance of MongoDB hosted in the same container, but it would not be too hard to modify it to work against a MySQL instance, either local or remote.

    I've put the Dockerfile up on Gist here as a starting reference.

    点赞 评论 复制链接分享
  • dongshan4316 dongshan4316 2年前

    This repository comes with a pre-configured mosquitto broker along with a PostgreSQL DB auth where you can add/edit/delete users.


    点赞 评论 复制链接分享