MySQL Change root Password

MySQL Change root Password

To change the password for the MySQL root user account, you will need to have access to the current password for the root user. If you do not have the current password for the root user, you will need to reset the password for the root user.

To change the password for the MySQL root user account, follow these steps:

  1. Connect to the MySQL server using the mysql utility. You can use the mysql utility to connect to the MySQL server as the root user. For example:
‮efer‬r to:lautturi.com
mysql -u root -p

Enter the current password for the root user when prompted.

  1. Use the SET PASSWORD command to change the password for the root user. You can use the following command to change the password for the root user:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');

Replace newpassword with the new password you want to set for the root user.

  1. Flush the privileges. After changing the password for the root user, you will need to flush the privileges to make the changes take effect. You can do this using the FLUSH PRIVILEGES command:
mysql> FLUSH PRIVILEGES;
  1. Disconnect from the MySQL server. Once you have finished changing the password and flushing the privileges, you can disconnect from the MySQL server by typing exit at the MySQL prompt:
mysql> exit

After changing the password for the root user, you should be able to log in to the MySQL server using the new password for the root user.

Created Time:2017-10-30 10:17:51  Author:lautturi