How do I change the root password in MySQL

To change the root password in MySQL, you can follow these steps:

First, log into MySQL as the root user. This is usually done via the command line. Once logged in, you can use the following command to change the password.

Here is an example of how to change the root password:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

After executing the above command, your root password will be updated. Make sure to replace new_password with a strong password of your choice.


MySQL root password change password database