select length(encrypt('foo', 'ff')) <> 0; length(encrypt('foo', 'ff')) <> 0 1 select old_password('test'), password('test'); old_password('test') password('test') 378b243e220ca493 378b243e220ca493 select length(encrypt('test')), encrypt('test','aa'); length(encrypt('test')) encrypt('test','aa') 13 aaqPiZY5xR5l. drop table if exists t1; create table t1 (name varchar(50), pw varchar(16)); insert into t1 values ('tom', password('my_pass')); set @pass='my_pass'; select name from t1 where name='tom' and pw=password(@pass); name tom select name from t1 where name='tom' and pw=password(@undefined); name drop table t1;