Follow Below steps To fix mqtt connection lost or connection refused error
Step 1
open SSH command prompt
Step 2
Locate mqtt installed folder
step 3
Run below command
# mosquitto -d
And finally publish a topic to test we are not getting any error
mosquitto_pub -t ‘Test Topic’ -m hello