MySQL8.0以下 update mysql.user set password='密码' where user='用户名'; update mysql.user set password=PASSWORD('密码') where User='用户名'; MySQL8.0以上 alter user '用户名'@'可访问IP' identified by '密码'; 可访问IP举例 localhost 本机访问 % 所有IP都可以访问 参考文章: https://www.cnblogs.com/honeynan/p/12408144.html