user

# 查询当前用户
select USER()
from dual;

database

# 查询当前数据库
select DATABASE()
from dual;

md5

# 计算 md5
select md5('luzhenfang')
from dual;

md5加密密码

create table user_test
(
    id   int,
    name varchar(10) not null default '',
    pwd  char(32)    not null default ''
);

insert into user_test
values (1, 'root', md5('123'));


select *
from user_test;


# 校验密码
select count(name)
from user_test
where name = 'root'
  and pwd = md5('123');

pasword


# 加密 mysql 自带加密
select password('@lzf123456LZF')
from dual;

Q.E.D.


全栈混子的菜鸡日常