I need to use a password to login to MySQL DB. But the password is stored in AES encryption algorithm.
The login will be:
AES_PASSWORD=2hhbdhbdhbdbh (the encrypted password in AES)
mysql -uroot -p$(AES_PASSWORD)
How do I decrypt this in shell and use it? I searched in other similar queries, and couldn't find anything related to AES.
You need to know more than just the password's AES string. You need to know which AES it was encrypted with, for example, and the key or password used to encrypt it.
But lets say you you're using aes256 and know the password is "secret". You can do this:
DECODED=`echo $AES_PASSWORD | openssl enc -d -a -aes256 -pass pass:secret`
And then call mysql with $DECODED as the password argument instead.
This may or may not be the best way to invoke mysql, however, as the password appears on the command line in plain text when someone looks at the process list with 'ps'.