1. Switch to the installation directory and set in emqx.conf
cd /etc/emqx/
Turn off anonymous login
allow_anonymous = false
2. Use the command line to enable user name authentication, and then use the command line to add the user name and password
cd /usr/lib/emqx/bin
Enable authentication plugin
./emqx_ctl plugins load emqx_auth_username
Add username and password
./emqx_ctl users add admin 123456
View the list of usernames
./emqx_ctl users list
Delete username
./emqx_ctl users del admin
After this setting is completed, the next startup will still take effect.