Cara Mengubah Password MySQL User Melalui Command Line

Dibawah ini terdapat langkah-langkah untuk mengubah password MySQL melalui Command Line.

$mysql -h localhost -u root -p
mysql> use mysql;
mysql> UPDATE user SET password=PASSWORD(“somesecretwords”) where User=’root’;
mysql> flushprivileges;
mysql> quit;

* normally, restart service not required. but if you need to restart mysql service: $sudo /etc/init.d/mysql restart