Difference between revisions of "Reset Password MySQL"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
Kita dapat merecover password server database MySQL dengan 5 langkah berikut: | Kita dapat merecover password server database MySQL dengan 5 langkah berikut: | ||
Line 15: | Line 12: | ||
/etc/init.d/mysql stop | /etc/init.d/mysql stop | ||
+ | |||
+ | killall mysqld | ||
+ | killall mysqld | ||
Output: | Output: | ||
Line 22: | Line 22: | ||
* Jalankan server MySQL tanpa password: | * Jalankan server MySQL tanpa password: | ||
− | + | sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking & | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
* Login ke server MySQL menggunakan client MySQL: | * Login ke server MySQL menggunakan client MySQL: | ||
− | mysql -u root | + | mysql -u root mysql |
Output: | Output: | ||
Line 43: | Line 37: | ||
* Tentukan password baru bagi pengguna root MySQL: | * Tentukan password baru bagi pengguna root MySQL: | ||
− | mysql | + | USE mysql; |
− | + | UPDATE user SET Password = PASSWORD('newpwd') WHERE Host = 'localhost' AND User = 'root'; | |
− | + | FLUSH PRIVILEGES; | |
− | + | quit | |
+ | |||
+ | * atau kalau password root 123456 | ||
+ | |||
+ | use mysql; | ||
+ | UPDATE user SET Password = PASSWORD('123456') WHERE Host = 'localhost' AND User = 'root'; | ||
+ | FLUSH PRIVILEGES; | ||
+ | quit | ||
+ | |||
− | * | + | * Hentikan server MySQL: |
/etc/init.d/mysql stop | /etc/init.d/mysql stop |
Latest revision as of 13:21, 29 July 2013
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
killall mysqld killall mysqld
Output:
Stopping MySQL database server: mysqld.
- Jalankan server MySQL tanpa password:
sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
- Login ke server MySQL menggunakan client MySQL:
mysql -u root mysql
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('newpwd') WHERE Host = 'localhost' AND User = 'root'; FLUSH PRIVILEGES; quit
- atau kalau password root 123456
use mysql; UPDATE user SET Password = PASSWORD('123456') WHERE Host = 'localhost' AND User = 'root'; FLUSH PRIVILEGES; quit
- 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