mysql set password for root@localhost code example Example: how to change mysql localhost password ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword'