Mosquitto broker connection error

I installed Mosquitto broker 5.1 via Home Assistant. I have made no changes to the standard setup. If I run this command from my computer

mosquitto_sub -d -t hello/world -h hassio.local -p 1883

I get:

Client mosq-mz3NTctQDCUHWS245x sending CONNECT
Client mosq-mz3NTctQDCUHWS245x received CONNACK (5)
Connection error: Connection Refused: not authorised.
Client mosq-mz3NTctQDCUHWS245x sending DISCONNECT

I have installed Mosquitto before on other setups and had not problems. I don’t know what is causing this problem. Is there something I need to set up, or otherwise?

You need to create a home assistant user for mqtt, and when you try mosquitto_sub, use the login and password from that home assistant user. Anonymous: true does not work with the add-on.

Thanks for that information, very useful. I will give that a try.