Hi,

Simply do the following:

INSERT INTO yourtable (username, password)
VALUES ('chichi', PASSWORD('jian1830'));

The encrypted password will look like this... 2748c558120ee3c9.  This is
MySQL's own internal encrypting function.

Remember to set the password to a, CHAR(16) binary not null, field.

Or, you could use MD5 to encrypt it as well.  Just remember that you
will need to program your server side language to encrypt the password
before checking against the database.... you probably know that already,
just thought I'd state the obvious.... (must be a British thing). ;)

Regards,

Kevin
----- Original Message -----
From: "Jianping Zhu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 04, 2003 7:58 PM
Subject: encrypted password


>
> I have mysql in a redhat machine. I need to use mysql do user
> authentication to a website.
> I have a table like following.
>
> +----------+----------+
> | username | passwd   |
> +----------+----------+
> | jianping | jian1830 |
> | chichi   | jian1830 |
> +----------+----------+
>
> I want the passwd field not to be plain text but encrypted. how can i
do
> that?
>
> Thanks.
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to