Selasa, 03 Mei 2011

Me-Reset password root database mysql di ubuntu 10.10

Pagi-pagi ingin-nya mengerjakan dan melanjutkan proyek yang belum selesai.. ternyata password root dari database mysql ngga bisa masuk. Kemungkinan kena hack pada waktu saya koneksi internet.



Okay.. tidak boleh larut dalam kesedihan...he3x. Setelah googling di internet menemukan solusinya, berikut langkah-langkah untuk mereset password root dari database mysql :

login ke superuser dari linux
# sudo su

# /etc/init.d/mysql stop
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql stop
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) utility, e.g. stop mysql
mysql stop/waiting

selanjutnya restart mysqld daemon-nya dengan mengetikkan command :

# mysqld_safe –skip-grant-tables &

Hasilnya :

[1] 4715
# 110119 23:49:49 mysqld_safe Logging to syslog.
110119 23:49:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

selanjutnya masuk ke mysql-nya

# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.49-1ubuntu8.1 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>

setelah berhasil masuk, ubahlah password dari mysql dengan menggunakan command :

mysql> update user set password=password(‘passwordYgDiinginkan’) where user=’root’;

Hasilnya :

Query OK, 3 rows affected (0.08 sec)
Rows matched: 3 Changed: 3 Warnings: 0

sampai disini password mysql telah berhasil direset. Jangan lupa untuk menyimpan selamanya konfigurasi yang telah kita ubah dengan mengetikkan command :

mysql> flush privileges;

Hasilnya :

Query OK, 0 rows affected (0.00 sec)
mysq>

Untuk mengeceknya, silahkan keluar dari mysql promt kemudian masuk lagi dengan command #mysql -u root -p masukkan password yang baru.

Selamat mencoba, semoga bermanfaat. :)


Sumber : http://nhie.wordpress.com/2011/01/19/reset-password-mysql-di-ubuntu-10-10/

Tidak ada komentar:

Posting Komentar

Terima kasih sudah membaca blog saya, silahkan tinggalkan komentar