Set Password in Mysql 5.6

tambahakan pada rc.conf

#mysql_enable=”YES”
#mysql_args=”– -skip-grant-tables — -skip-networking”

restart service mysql

#usr/local/etc/rc.d/mysql-server restart

Login mysql dengan user root

#mysql -u root

>use mysql;

> update user set password=password(“newpassword”) where user=”root”;

>exit;

 

 

mysql> SELECT User, Host, Password FROM mysql.user;
+——+————–+———-+
| User | Host         | Password |
+——+————–+———-+
| root | localhost    |                  |
| root | xxxx.ac.id  |                   |
| root | 127.0.0.1    |                  |
| root | ::1                |                    |
|          | localhost    |                  |
|          | xxxx.ac.id |                      |
+——+————–+———-+
6 rows in set (0.00 sec)

shell> mysql -u root
mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
    ->     WHERE User = 'root';
mysql> FLUSH PRIVILEGES; mysql> SELECT User, Host, Password FROM mysql.user; +------+--------------+-------------------------------------------+ | User | Host         | Password                                  | +------+--------------+-------------------------------------------+ | root | localhost    | *4B7EC5AD1342E0011F75151A84C077B6ED45FC9 | | root | db.uns.ac.id | *4B7EC5AD1342E0011F75151A84C077B6ED45FC9 | | root | 127.0.0.1    | *4B7EC5AD1342E0011F75151A84C077B6ED45FC9 | | root | ::1          | *4B7EC5AD1342E0011F75151A84C077B6ED45FC9 | |      | localhost    |                                           | |      | db.uns.ac.id |                                           | +------+--------------+-------------------------------------------+ 6 rows in set (0.00 sec) mysql> exit; Bye 
shell>