We can easily configure the MySQL Mosquitto-auth plugin. It is open source dynamic security plugin. Developed with rust programming language.
- Install the Mosquitto (MQTT) to Server Install the mosquitto from Ubuntuโs software repository.
Update the package information
sudo apt update
- Install the mosquitto package.
sudo apt install -y mosquitto
- Stop the mosquitto service
sudo systemctl stop mosquitto
Download mosquitto-auth.so file (Download)
Edit mosquitto.conf file
sudo vi /etc/mosquitto/mosquitto.conf
- And add the following entries to the mosquitto.conf file.
plugin /path/to/mosquitto_auth.so
#listener 1883
Configure MySQL Database and Tables
Download the mosquitto.sql file and import it to your MySQL by PHPMyAdmin. Then create a .env file and add database credentials.
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=mosquitto
DB_USERNAME=root
DB_PASSWORD="Pass"
Move .env file to /
mv /path/to/.env /.env
Start the mosquitto server
sudo systemctl start mosquitto
Now it is ready to check username with password and permission.
Top comments (0)