I have installed mosquitto broker and Node red in my PC.
I'm able to subscribe and publish messages.
But in Node red i'm unable to connect to mqtt.
17 May 10:46:25 - [info] Starting flows 17 May 10:46:25 - [info] Started flows 17 May 10:46:25 - [info] [mqtt-broker:cb3902d2d36e9b73] Connection failed to broker: mqtt://localhost:1883
You might want to install MQTT Explorer if running Windows. You can then test a different connection to the broker. If that doesn't work, I would check the Mosquitto configuration and if that still doesn't turn up the issue, increase Mosquitto's logging level to see what the problem is.
Is NR running on the same device as mosquito? As is, you are trying to connect to a broker on the same device. If it is on another device, you need to specify the IP of the device running mosquito.