mysql加密函数怎么用 mysql数据加密存储

mysql中建表怎么给密码加密,用MD5?CREATE TABLE `tablename` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL DEFAULT '',
`password` varchar(32) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=gb2312;
password 在输入后用PHP MD5()函数加密即可
MYSQL AES 加密使用mysql的加密函数运行:
select HEX(AES_ENCRYPT( 'test aes encrypt','123')) as aesTest
输出密文:
17CDAE577C715A0B5A922BF07462622AF15884B6D0F596B0241DC8F966C4A93F
官方文档解释:
Theblock_encryption_modesystem variable controls the mode for block-based encryption algorithms. Its default value is font color="red"aes-128-ecb /font, which signifies encryption using a key length of 128 bits and ECB mode. For a description of the permitted values of this variable, seeSection 5.1.8, “Server System Variables” .
在线加密验证 :
该网加密结果为:
17cdae577c715a0b5a922bf07462622af15884b6d0f596b0241dc8f966c4a93f
与mysql加密结果一致,只是大小写差异 。
mysql没有密码怎么设置密码方法一:最简单mysql加密函数怎么用的方法mysql加密函数怎么用,也是安装完mysql后 , 系统提示mysql加密函数怎么用的方法 。使用mysqladmin来完成 。shell
mysqladmin
-u
root
password
"newpwd"
shell
mysqladmin
-u
root
-h
host_name
password
"newpwd"password后面的双引号不是必须的 , 不过如果密码包含空格或者一些特殊的符号,需要用引号 。方法二:利用mysql里面的set
password命令来完成 , 注意必须使用password()函数来加密设置的这个newpwd,否则直接='newpwd'不会生效 。不过如果使用方法一用mysqladmin
【mysql加密函数怎么用 mysql数据加密存储】password设置密码或者用grant来设置,就不用使用password()函数 , 因为它们已经自动调用了该函数 。shell
mysql
-u
root
mysql
set
password
for
'root'@'localhost'
=
password('newpwd');
mysql
set
password
for
'root'@'host_name'
=
password('newpwd');
方法三:直接通过update
user表来设置密码shell
mysql
-u
root
mysql
update
mysql.user
set
password
=
password('newpwd')
-
where
user
=
'root';
mysql
flush
privileges;
如果忘记mysql的root密码可以采取下面的步骤重新设置
1 。kill掉所有mysql的进程
2 。使用--skip-grant-tables的参数启动mysql
shell
mysqld_safe
--skip-grant-tables
3 。设置新的密码,同样两种方式可以选择
方法一
shell
mysqladmin
-u
root
flush-privileges
password
"newpwd"
方法二
mysql
update
mysql.user
set
password=password('newpwd')
-
where
user='root';
mysql
flush
privileges;
4 。停止mysql
server , 用正常的模式启动
5 。ok,可以使用新设置的密码了
关于mysql加密函数怎么用和mysql数据加密存储的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。

    推荐阅读