Encrypt function in MYSQL is not working!!

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Mohammad
Forum Newbie
Posts: 24
Joined: Tue Jul 26, 2005 5:31 am

Encrypt function in MYSQL is not working!!

Post 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.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post 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).
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

or try passing encrypt to password
Mohammad
Forum Newbie
Posts: 24
Joined: Tue Jul 26, 2005 5:31 am

Post 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.
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

i think he must mean use PASSWORD() instead of ENCRYPT() in your code.
Post Reply