Can't get AES_DECRYPT to work

Am trying to decypt a string that has been successfully encrypted using AES_ENCRYPT in MySQL..

I ran ....
update table set string_encrypted= AES_ENCRYPT(string,'password')

To decrypt I've run...
select AES_DECRYPT(string_encrypted,'password') from table

but I keep on getting back NULL.... no syntax errors.

I know the encryted value is in the field and if I copy and paste the value into the query it works.
I'm using varchar but have also tried blob, binary, text and all sorts of other combinations.

Thanks for help...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I believe you need to supply the "alias" for the unencrypted field. Try:
select AES_DECRYPT(string_encrypted,'password') AS oldString from table

oldString is the field that will contain your unencrypted data
inajamAuthor Commented:
Thanks hielo, but that doesn't seem to make any difference... still getting NULL returned.

OK, the manual says "The input arguments may be any length. If either argument is NULL, the result of this function is also NULL. Because AES is a block-level algorithm, padding is used to encode uneven length strings"

Hence, try:

select AES_DECRYPT( REPLACE(`string_encrypted`,'\0',''), 'password') AS oldString from table

If that does not work, it could be a driver issue. Refer to the following:
specifically, the last post.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
inajamAuthor Commented:
Thanks hielo

It does look like a driver issue from my windows machine since the decrypt works when I make a query using my server side language.   I just assumed that if the query didn't work from my machine it wouldn't work at all.  
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.