What is the mqtt-cli command to publish and subscribe with credentials

I enabled Hive ESE so I need to provide user name and password during sub and pub.
I was using

docker run hivemq/mqtt-cli sub -t /topic/subtopic/mytopic -h xx.xx.xx.xx
docker run hivemq/mqtt-clipub -t /topic/subtopic/mytopic -m Hello! -h xx.xx.xx.xx

Can you give me the similar command as above but with the user name and password arguments?

Thank you!

Hello @Susan

You can use something like the sample below. To display all MQTT CLI parameters please use --help parameter.

docker run hivemq/mqtt-cli sub -t /topic/subtopic/mytopic -h xx.xx.xx.xx -u TYPE_YOUR_USERNAME -pw TYPE_YOUR_PASSWORD

docker run hivemq/mqtt-cli pub -t /topic/subtopic/mytopic -m Hello! -h xx.xx.xx.xx -u TYPE_YOUR_USERNAME -pw TYPE_YOUR_PASSWORD

Kind regards,
Diego from HiveMQ Team

Thank you what if I want to subscribe to all topic? Is the following correct? or I need to quote # or I still need a /topic/#?
docker run hivemq/mqtt-cli sub -t # -h xx.xx.xx.xx -u TYPE_YOUR_USERNAME -pw TYPE_YOUR_PASSWORD

Hello @Susan

It’s correct! If you’re looking to dive into the topic and understand it better, a great starting point would be our “MQTT Essentials” series. It provides comprehensive insights into MQTT and can help lay a strong foundation for you.

Kind regards,
Diego from HiveMQ Team