Page 1 of 1

Encrypt function in MYSQL is not working!!

Posted: Mon Oct 10, 2005 3:06 am
by Mohammad
Hello

I'm tryin this code in MYSQL:

Code: Select all

insert into users (email, password, active, type) values ('someone@yahoo.com', encrypt('******'), 1,9)
but this is the error which I get:

MySQL said:

#1048 - Column 'PASSWORD' cannot be null

does this mean my system doesnt support the ENCRYPT fucntion!!

but when I use MD5 it fine, I'm running win xp IIS.

any help is much appreciated.

Posted: Mon Oct 10, 2005 10:50 am
by onion2k
MySQL's encrypt function uses the unix crypt system call. It's not available on Windows as far as I'm aware. Use AES_ENCRYPT() instead. (But read the documentation first, coz it's not quite the same thing).

Posted: Mon Oct 10, 2005 12:38 pm
by John Cartwright
or try passing encrypt to password

Posted: Tue Oct 11, 2005 2:47 am
by Mohammad
thanx for the replies!

but JCART I dont quite get the thing you say which was "try passing encrypt to password"?

can you explain abit more, perhaps with an example?

thanx in advance.

Posted: Tue Oct 11, 2005 3:20 am
by jayshields
i think he must mean use PASSWORD() instead of ENCRYPT() in your code.