I do not remember the root password of MySQL, how can I change it?

If by chance you do not remember the password of the MySQL server...

You can retrieve the situation with the following procedure.

First, stop the MySQL daemon:

/etc/init.d/mysql stop

then restart it in this way:

mysqld_safe --skip-grant-tables --skip-networking &

the parameter --skip-grant-tables allows you to bypass authentication, while the parameter --skip-networking serves to prevent that someone will take advantage to perform transactions on the network that would otherwise be prohibited if the authentication table were active.

After running the previous commands, we can connect to MySQL running:

mysql -u root

and to change the root password:

mysql> update mysql.user set password=password("new password") where user="root";
mysql> FLUSH PRIVILEGES;

finally, after it left the console for MySQL, just restart the daemon in normal mode:

/etc/init.d/mysql restart

The use of the information shown here is at your risk.
Cyber Methexis disclaims any liability for malfunction and/or loss of data.


Tag cloud

sicurezza linux tips and tricks sistemi operativi software microsoft networking informatica scripting windows apple internet scripts open source downloads hardware