更改用戶名密碼,官方推薦使用alter
ALTER USER test@'%' IDENTIFIED BY '123456';
還有一種
update mysql.user set authentication_string=password("新密碼") where User="test" and Host="localhost";
用update語句需要flush privileges;
參考
MySQL 5.7推薦使用ALTER USER修改密碼 https://majing.io/posts/10000005531181
MySql 5.7中添加用戶,新建數據庫,用戶授權,刪除用戶,修改密碼 - Pkj - 博客園 https://www.cnblogs.com/pkjplayer/p/7681281.html