Reset password root mysql

Database 21 August 2008 | 5 Comments

Namanya juga manusia yang suka lupa dan penuh dosa, jadi kalau cuman sekedar lupa password itu biasa. Yang penting cari solusi buat problemnya, kalau yang lupa itu password root di server mysql maka jurus yang bisa di lakukan seperti ini caranya :-) :

Catatan : Saya lakukan di server FreeBSD 7.0 release dengan mysql ports.

1. matikan service mysql yg sedang jalan

sandbox# /usr/local/etc/rc.d/mysql-server stop

2. jalankan mysql dgn modus skip grant table

sandbox# mysqld_safe –skip-grant-tables &
[1] 5187
sandbox# Starting mysqld daemon with databases from /var/db/mysql

sandbox#

3. login sbg user root dengan password kosong

sandbox# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.51a FreeBSD port: mysql-server-5.0.51a

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>

4. ganti password root dengan password yg di inginkan

mysql> update user set password=password(’xxxxyyyy’) where user=’root’;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
5. Matikan mysql nya

sandbox# /usr/local/etc/rc.d/mysql-server stop

6. Hidupkan service mysql yang ‘normal’

sandbox# /usr/local/etc/rc.d/mysql-server start

Selesai .

P.S : kasus khusus, cek host yang ada di server

sandbox# mysql -uroot -p -h 127.0.0.1 # dengan host = 127.0.0.1
sandbox# mysql -uroot -p # login ini sama denga host = localhost

sandbox# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.0.51a FreeBSD port: mysql-server-5.0.51a

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select user,host from user;
+——-+———–+
| user | host |
+——-+———–+
| root | 127.0.0.1 |
| fikri | localhost |
| hanz | localhost |
| root | localhost |
+——-+———–+
4 rows in set (0.11 sec)

Incoming search terms for the article:

  • ganti password mysql
  • ganti password root mysql
  • mengganti password mysql
  • lupa password localhost
  • merubah password root mysql

Tagged in , ,

5 Responses on “Reset password root mysql”

  1. trendy says:

    wew…bso sedetail itu…!
    salute..saluteeee!
    wkekekeke!

  2. Netter says:

    Makasih ini yang aku cari…

  3. adit says:

    Makasi yah buat info artikelnya, kbetulan skrg sya lg da praktikum ini, sangat membantu kuliah saya :)

  4. aq belum maksud ttng mysql dg database, pingin belajar lg…

WP Plugin IMDB Grabber