'how can run command on redis with authorize in bash script?

I have redis version 6.2.2 AUTH with username and password on centos 7

I want run command flushall with bash script

I tried send it with echo command but it failed

I do not know how can i send 2 command

How can i send AUTH myusername mypassword command and and after that flushall command with bash script?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source