mysql_root

Reset password root mysql

Pikun dah………! enggak tau karena sedang mikirin siapa atau apa sehingga password kuncen (root) mysql salah satu server lupa. Al hasil reset password tak terhindarkan :D. Dalam tulisan ini terdapat dua langkah “bagaimana mereset password root mysql” atau dalam bahasa inggrisnya “how to reset password root mysql” :D. The following sections provide instructions for Unix systems, as well as generic instructions that apply to any system..

Langkah pertama ini adalah langkah primitif untuk mereset password root mysql, dan dalam beberapa kasus langkah ini menyebabkan database corrupt, jika terpaksa reset password root mysql dengan cara ini, please read the folowing step:

Stop mysql service:

# /etc/init.d/mysqld stop

Start MySQL using safe mode and skip grant privileges:

# mysqld_safe –skip-grant-tables &

Connect to MySQL service using MySQL Client:

# mysql -u root

Update password root:

mysql> use mysql;
mysql> update user set password=PASSWORD(“Password Baru”) where User=’root’;
mysql> flush privileges;
mysql> quit

And then stop MySQL service and start again in normal mode:

# service mysqld stop && service mysqld start

Oke, next adalah how to reset password root mysql dengan cara yang lebih aman, see below:

Create new sql file for update the root password:

# vi mysql_reset_pw.sql

UPDATE mysql.user SET Password=PASSWORD(‘Password_Baru’) WHERE User=’root’;
FLUSH PRIVILEGES;

And then stop MySQL service:

# /etc/init.d/mysqld stop

Now start MySQL service using init file to update root password:

# mysqld_safe –init-file=/root/mysql_reset_pw.sql &

After MySQL started please delete file mysql_reset_pw.sql for some reason, and please restart the MySQL service:

# service mysqld stop && service mysqld start

Voila.., the mysql root password was recovered…

One thought on “Reset password root mysql

Leave a Reply

Your email address will not be published. Required fields are marked *


*