mysql批量刷新用户密码

不知道用户密码,并且不改变用户密码的情况下,批量刷新MySQL数据库用户的密码

select concat('alter user \'',user,'\'@\'',host,'\' identified by \'',authentication_string,'\';') as change_password from mysql.user;

 

扩展:

在其他MySQL实例创建与本实例密码相同的用户

select concat('create user \'',user,'\'@\'',host,'\' identified by password \'',authentication_string,'\';') as create_user from mysql.user;

 

posted @ 2020-05-29 16:09  orcl  阅读(305)  评论(0编辑  收藏  举报