Cara Reset Password Root di MariaDB Linux
Matikan service mysql
1
$ sudo /etc/init.d/mysql stop
Jalankan safe mode di mariadb untuk masuk kedalam database tanpa menggunakan password
1 2 3 4 5 6
$ sudo mysqld_safe --skip-grant-tables & [1] 24361 $180426 10:20:56 mysqld_safe Logging to syslog. 180426 10:20:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Jalankan mariadb
1 2 3 4 5 6 7 8 9
$ mysql -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 1 Server version: 5.5.33a-MariaDB MariaDB Server Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB >
Reset password mariadb
1 2 3 4 5 6 7 8 9 10 11 12 13 14
MariaDB [(none)]> 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 MariaDB [mysql]> update user set password=PASSWORD("new_password;") where User='root'; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [mysql]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> quit ByeRestart mariadb
1
$ sudo /etc/init.d/mysql restart
Selesai. Sekarang coba masuk kedalam mariadb menggunakan password yang baru kita ubah tadi
1 2 3 4 5 6 7 8 9 10 11
# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 10.1.29-MariaDB-6 Debian buildd-unstable Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
Jika masih gagal untuk masuk dengan menampilkan pesan error seperti dibawah ini :
1
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Lakukan proses yang sama hingga langkah 3 diatas kemudian lakukan perintah dibawah ini :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
MariaDB [(none)]> 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 Database changed MariaDB [mysql]> UPDATE user SET plugin=""; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [mysql]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> quit Bye
Kemudian coba lagi untuk masuk kedalam MariaDB.
Semoga Berhasil…
This post is licensed under CC BY 4.0 by the author.