Difference between revisions of "Reset Password MySQL"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
Line 26: | Line 26: | ||
121224 11:09:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql | 121224 11:09:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql | ||
121224 11:09:55 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended | 121224 11:09:55 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended | ||
− | |||
[1]+ Done mysqld_safe –skip-grant-tables | [1]+ Done mysqld_safe –skip-grant-tables | ||
Line 42: | Line 41: | ||
* Tentukan password baru bagi pengguna root MySQL: | * Tentukan password baru bagi pengguna root MySQL: | ||
− | + | use mysql; | |
− | + | update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’; | |
− | mysql | + | flush privileges; |
− | + | quit | |
+ | |||
+ | * atau kalau password root 123456 | ||
+ | |||
+ | use mysql; | ||
+ | update user set password=PASSWORD(“123456”) where User=’root’; | ||
+ | flush privileges; | ||
+ | quit | ||
+ | |||
* 5: Hentikan server MySQL: | * 5: Hentikan server MySQL: |
Revision as of 11:12, 24 December 2012
Kita dapat merecover password server database MySQL dengan 5 langkah berikut:
- Hentikan (stop) proses server MySQL.
- Jalankan (start) proses server atau daemon MySQL (mysqld) dengan opsi –skip-grant-tables sehingga tidak akan menampilkan prompt password.
- Masuk (login melalui tool mysql) ke server MySQL sebagai pengguna root.
- Tulis password baru bagi root.
- Keluar dan restart server MySQL.
Berikut ini adalah contoh penerapan kelima langkah di atas (pastikan anda login di Linux sebagai ‘root’, kalo di Windows jadilah Administrator tertinggi):
- Hentikan layanan MySQL:
/etc/init.d/mysql stop
Output:
Stopping MySQL database server: mysqld.
- Jalankan server MySQL tanpa password:
mysqld_safe –skip-grant-tables &
Output:
121224 11:09:53 mysqld_safe Logging to syslog. 121224 11:09:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 121224 11:09:55 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended [1]+ Done mysqld_safe –skip-grant-tables
- Login ke server MySQL menggunakan client MySQL:
mysql -u root
Output:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer. mysql>
- Tentukan password baru bagi pengguna root MySQL:
use mysql; update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’; flush privileges; quit
- atau kalau password root 123456
use mysql; update user set password=PASSWORD(“123456”) where User=’root’; flush privileges; quit
- 5: Hentikan server MySQL:
/etc/init.d/mysql stop
Output:
Stopping MySQL database server: mysqld STOPPING server from pid file /var/run/mysqld/mysqld.pid mysqld_safe[6186]: ended [1]+ Done mysqld_safe –skip-grant-tables
Jalankan server MySQL dan uji perubahan yang telah terjadi:
/etc/init.d/mysql start mysql -u root -p
Cara Reconfigure MySQL di Debian / Ubuntu
Kalau di Debian dan anak cucunya malah lebih gampang lagi Pak, tinggal dgn satu perintah:
sudo dpkg-reconfigure mysql-server
selesai masalah