MySQL reset password for user account

MySQL reset password for user account

To reset the password for a MySQL user account, you can use the mysqladmin utility. The mysqladmin utility allows you to perform various administrative tasks on a MySQL server, including resetting passwords.

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

To reset the password for a MySQL user account, follow these steps:

  1. Stop the MySQL server. You can use the systemctl command to stop the MySQL server on most Linux systems. For example:
refer t‮al:o‬utturi.com
systemctl stop mysql
  1. Start the MySQL server in safe mode. To start the MySQL server in safe mode, you will need to pass the --skip-grant-tables option to the mysqld command. This will allow you to bypass the normal authentication process and connect to the MySQL server as the root user without a password.

  2. 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:

mysql -u root
  1. Reset the password for the user account. Once you have connected to the MySQL server, you can use the SET PASSWORD command to reset the password for the user account. For example, to reset the password for the user john:
mysql> SET PASSWORD FOR 'john'@'localhost' = PASSWORD('newpassword');

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

  1. Flush the privileges. After resetting the password for the user account, 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. Restart the MySQL server. Once you have finished resetting the password and flushing the privileges, you can stop the MySQL server in safe mode and restart it in normal mode. You can use the systemctl command to restart the MySQL server on most Linux systems. For example:
systemctl start mysql

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

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