Archive

How to change the mysql root password?

How to change the mysql root password?

How to reset the MySQL root password
The MySQL root password can be reset in this post. You might need to do this if you’ve forgotten your password only

To reset the MySQL root password, you must have root access on the server.

Changing the password for MySQL’s root user
Follow these procedures to change password root mysql:
a) Log in to your account using SSH
“The instructions in the following stages must be run as the root user. As a result, you can either log in as the root user (which is not recommended for security reasons) or run the tasks as the root user using the su or sudo commands.”
b) Using the relevant command for your Linux distribution, stop the MySQL server:
* For CentOS and Fedora, type: service mysqld stop
* For Debian and Ubuntu, type: service mysql stop
c) With the —skip-grant-tables option, restart the MySQL server. Type the following command to do so:
mysqld_safe –skip-grant-tables &
**Make careful to finish the command with an ampersand (&). This allows you to type the commands in the next stages while the command is running in the background.
**Running MySQL with the —skip-grant-tables option enabled is extremely risky, and should only be done temporarily while you reset your password. After you’ve reset the root password, follow the instructions below to safely end the mysqld safe server instance and start the MySQL server.
d) Use the following command to connect to MySQL:
mysql
e) Reset the password at the mysql> prompt. To do so, run the command below, substituting new-password with your new root password:

UPDATE mysql.user SET Password=PASSWORD(‘new-password’) WHERE User=’root’;
f) Type the following commands at the mysql> prompt:

FLUSH PRIVILEGES;
exit;

g) Using the following command, you can shut down the MySQL server. Before the MySQL server shuts down, you’ll be requested to enter the new MySQL root password:

mysqladmin -u root -p shutdown

h) Normally start the MySQL server. To do so, run the following command, depending on your Linux distribution:
* For CentOS and Fedora, type:
service mysqld start
* For Debian and Ubuntu, type:
service mysql start

Hi This is all for your help to assist on forgot mysql root password, mysql root password reset and how to reset mysql root password.
Do this Task Now change password root mysql, how to change the mysql root password