Cara Menghapus Password User MySQL
Jika yang anda inginkan adalah menghapus password dari seorang user secara keseluruhan, maka cukup memberikan string kosong sebagai isian password.
SET PASSWORD FOR 'nama_user'@'lokasi_user' = ''
Berikut saya contohkan ketika menghapus password untuk user ekonomi_admin melalui user root:
D:\MySQL\bin>mysql -uroot -pqwerty Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 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 FOR ekonomi_admin@'localhost' = ''; Query OK, 0 rows affected (0.00 sec) mysql> SHOW GRANTS FOR ekonomi_admin@localhost \G *************************** 1. row *************************** Grants for ekonomi_admin@localhost: GRANT USAGE ON *.* TO 'ekonomi_admin'@'localhost' *************************** 2. row *************************** Grants for ekonomi_admin@localhost: GRANT ALL PRIVILEGES ON `universitas`.`mahasiswa_ekonomi` TO 'ekonomi_admin'@'localhost' 2 rows in set (0.00 sec)
Terlihat dari hasil SHOW GRANTS FOR, user ekonomi_admin tidak memiliki password, dan user tersebut dapat masuk kedalam MySQL tanpa password sama sekali.
0 Komentar