Cara Merubah Password User MySQL dari User itu Sendiri

Cara Merubah Password User MySQL dari User itu Sendiri



Untuk merubah password dari user yang kita login saat ini, bisa menggunakan perintah yang lebih sederhana:
SET PASSWORD=PASSWORD('the_password')
Berikut adalah contoh query dimana saya login sebagai ilkom_admin dengan password ‘s3cret’ dan mengubahnya menjadi ‘4dmin’:
D:\MySQL\bin>mysql -uilkom_admin -ps3cret

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SET PASSWORD = PASSWORD('4dmin');
Query OK, 0 rows affected (0.00 sec)
Password baru tersebut akan aktif setelah user keluar dari sesi MySQL saat ini.

0 Komentar