Change MySQL root password

Change MySQL root password

To change the MySQL root password, you will need to use the mysql command-line client and update the user table in the mysql database.

First, log in to the MySQL server as the root user:

refer t‮l:o‬autturi.com
mysql -u root -p

Enter the current root password when prompted.

Next, use the following SQL statements to change the root password:

USE mysql;
UPDATE user SET authentication_string=PASSWORD('new_password') WHERE User='root';
FLUSH PRIVILEGES;

Replace new_password with the new password that you want to use.

This will update the authentication_string column in the user table with the new password and flush the privileges to apply the changes.

To exit the MySQL command-line client, use the exit command.

exit;

Keep in mind that this is just a basic example of how to change the MySQL root password. You may need to customize the procedure to meet the specific requirements of your system and security policies. You should also regularly review and update the password to ensure that it is secure and resistant to attacks.

Created Time:2017-10-28 14:02:22  Author:lautturi