Mysql5.7后的password加密和md5

5.7之后

  • password函数旧版16位,新版41位,可用select password(‘123456’)查看。
  • md5加密算法,只有16位和32位两种

authentication_string

且5.7之后移除了password,它采用了新的算法

  • 5.7之前
mysql> select user,host,password from mysql.user;
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
  • 5.7之后
mysql> select user,host,authentication_string from mysql.user;
+------+-----------+-------------------------------------------+
| user | host      | authentication_string                     |
+------+-----------+-------------------------------------------+
| root | localhost | *8A7993B6A9F0539BBE570DB3FD66FC580093FB05 |
| root | %         | *8A7993B6A9F0539BBE570DB3FD66FC580093FB05 |
+------+-----------+-------------------------------------------+
2 rows in set (0.00 sec)

在5.7中

  • PASSWORD() (已弃用5.7.6) 计算并返回密码字符串

在8.0中

PASSWORD(str)
This function was removed in MySQL 8.0.11.

https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_password

你可能感兴趣的:(数据库)