Pengen Punya WebSite instan kualitas intan ?

Thursday, March 24, 2011

Reset password root mysql pada linux

Stop service mysql

[root@prayoga ~]# /etc/init.d/mysqld stop
Stopping MySQL:                                            [  OK  ]


Start MySQL (mysqld) server/daemon dengan --skip-grant-tables

[root@prayoga ~]# mysqld_safe --skip-grant-tables &

Login mysql sebagai root dengan tanpa password.

[root@prayoga ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.77 Source distribution


Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


mysql>


set password baru

mysql> 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
mysql> update user set password=password("password_baru") where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


mysql> quit


restart mysql services

[root@prayoga ~]# /etc/init.d/mysqld stop
STOPPING server from pid file /var/run/mysqld/mysqld.pid
110324 01:04:34  mysqld ended


Stopping MySQL:                                            [  OK  ]
[1]+  Done                    mysqld_safe --skip-grant-tables



[root@prayoga ~]# /etc/init.d/mysqld start
Starting MySQL:                                            [  OK  ]
selanjutnya tes login ke mysql sebagai root dengan password baru :)

0 comments:

Post a Comment