日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

mysql修改字段類型語句 mysql修改字段類型( 三 )


MySQL的配置文件my.cnf中配置默認(rèn)的密碼認(rèn)證插件的方式如下:
[mysqld]
default_authentication_plugin=mysql_native_password
# 或者下面的使用sha256_password作為默認(rèn)的密碼認(rèn)證插件
# default_authentication_plugin=sha256_password
IDENTIFIED WITH auth_plugin
如果我們要修改某一個(gè)用戶的密碼認(rèn)證插件,就可以使用到IDENTIFIED WITH auth_plugin這個(gè)語句了 。如果一個(gè)用戶它的密碼認(rèn)證插件使用的是默認(rèn)的mysql_native_password,我們想把它的密碼認(rèn)證插件修改為sha256_password,此時(shí)我們就可以使用下面的命令來修改:
alter user xyz identified with sha256_password;
執(zhí)行完成上述命令后,xyz這個(gè)用戶的密碼就會(huì)設(shè)置為空,并更新它的密碼為已經(jīng)過期,同時(shí)更新了它的密碼認(rèn)證插件為sha256_password,結(jié)果如下所示:
mysql> select user, host, plugin, authentication_string, password_expired from mysql.user where user ='xyz';
+——+——+———————–+——————————————-+——————+
| user | host | plugin| authentication_string| password_expired |
+——+——+———————–+——————————————-+——————+
| xyz| %| mysql_native_password | *39C549BDECFBA8AFC3CE6B948C9359A0ECE08DE2 | N|
+——+——+———————–+——————————————-+——————+
1 row in set (0.03 sec)
mysql> alter user xyz identified with sha256_password;
Query OK, 0 rows affected (0.02 sec)
mysql> select user, host, plugin, authentication_string, password_expired from mysql.user where user ='xyz';
+——+——+—————–+———————–+——————+
| user | host | plugin| authentication_string | password_expired |
+——+——+—————–+———————–+——————+
| xyz| %| sha256_password || Y|
+——+——+—————–+———————–+——————+
1 row in set (0.02 sec)
mysql>
更改用戶的密碼認(rèn)知方式之后,當(dāng)xyz再次嘗試登錄MySQL數(shù)據(jù)庫(kù)的時(shí)候,輸入空密碼登錄成功后,會(huì)要求其修改一下自己的密碼,然后才可以執(zhí)行其他SQL語句的操作,這個(gè)要求和我們剛安裝MySQL數(shù)據(jù)庫(kù)后,第一次使用root登錄的時(shí)候要求修改root的密碼是一樣的 。下面是修改完成用戶xyz的密碼認(rèn)證插件之后,嘗試使用空密碼登錄后的操作示例:
?Downloads mysql -uxyz -p -h10.2.1.7
Enter password:
Welcome to the MySQL monitor.Commands end with ; or \\g.
Your MySQL connection id is 45197703
Server version: 5.7.25-log
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.
mysql> select version();
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. # 這里提示需要修改完成密碼之后才可以執(zhí)行其他SQL語句命令 。

推薦閱讀