update user_table set user_password=password(1234) where user_id='1';请问这样把密码加密后,如何解密呢?
另外,如何把自己输入的秘密和数据库中的密码对比是否一致呢?
例如:查询 select password(1234); 
和查询     select user_password from user_table where user_id='1';
这两个语句的结果是不一样的,请问如何对比加密之前的密码和加密之后的密码呢?
谢谢!

解决方案 »

  1.   

    一般是如下两种方法判断用户登录账号是否正确。select * from user_table where  user_id='1' and user_password=password(1234);select user_password,password(1234) from user_table where user_id='1';
      

  2.   

    如果能解密,用户只要能访问表,就知道密码了。
    这个肯定是单向的。
    select * from user_table where user_id='**' and user_password=password('***)
      

  3.   


    --------------------------------------
    谢谢!问题是
    select user_password,password(1234) 
    这两项查出来之后是不相等的,请问这是为什么呢,该如何解决呢?谢谢!
      

  4.   

    update user_table set user_password=password(1234) where user_id='1';
    -----------------------------------------
    请问我这样设置密码有问题么?
    select user_password,password(1234) from user_table where user_id='1';
    为什么这里查询出来的user_password和password(1234) 不一样呢?帮帮忙啊,谢谢!
      

  5.   

    password(1234)查询出来的结果是:
    *A4B6157319038724E3560894F7F932C8886EBFCF
    user_password 查询出来的结果是:
    *A4B6157319038724E3560894F7F932C前面都是一样的,就是后面不一样,请问这是为什么呢?谢谢!
      

  6.   

    加上引号! 楼主估计从来没看过MYSQL的手册吧 
     PASSWORD()本身就是针对字符串的。 另外你的user_password字段定义了多长?
      

  7.   

    -----------------
    user_password字段定义的是 32位,另外,用old_password('1234')这个方法可以吧呵呵,我现在是这么写的,没问题吧?