Monday, April 21, 2008

reset password mysql root

Lupa password mysql nih caranya ..........

dev includes # /etc/init.d/mysqld stop
Stopping MySQL: [ OK ]
dev includes # mysqld_safe --skip-grant-tables
Starting mysqld daemon with databases from /var/lib/mysql

mysql --user=root mysql

[1]+ Stopped mysqld_safe --skip-grant-tables
dev includes # mysqld_safe
A mysqld process already exists

dev includes # mysql --user=root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.20

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

mysql> update user set Password=PASSWORD('root');
Query OK, 6 rows affected (0.02 sec)
Rows matched: 6 Changed: 6 Warnings: 0

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

mysql> exit
Bye
dev includes # ps x
PID TTY STAT TIME COMMAND
1 ? S 0:00 init [3]
2 ? S 0:00 [migration/0]
3 ? SN 0:00 [ksoftirqd/0]
4 ? S 0:00 [watchdog/0]
5 ? S< 0:00 [events/0]
6 ? S< 0:00 [khelper]
7 ? S< 0:00 [kthread]
8 ? S< 0:00 [xenwatch]
9 ? S< 0:00 [xenbus]
16 ? S< 0:00 [kblockd/0]
52 ? S 0:00 [pdflush]
53 ? S 0:00 [pdflush]
55 ? S< 0:00 [aio/0]
188 ? S< 0:00 [cqueue/0]
189 ? S< 0:00 [kseriod]
54 ? S 0:00 [kswapd0]
301 ? S 0:01 [kjournald]
330 ? S< 0:00 [kauditd]
891 ? Ss 0:00 udevd
1576 ? Ss 0:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
1709 ? Ss 0:00 crond
1753 ? Ss 0:00 hald
1766 ? S 0:00 su -s /bin/sh -c /opt/openfire/jre/bin/java -server
9033 ? Ss 0:00 /usr/sbin/sshd
9342 ? Ss 0:00 /usr/sbin/httpd
11684 tty1 Ss+ 0:00 /sbin/mingetty tty1
16012 ? Ss 0:00 /usr/bin/perl /usr/libexec/webmin/miniserv.pl /etc/we
27704 ? S 0:00 /usr/bin/perl /usr/libexec/webmin/miniserv.pl /etc/we
27705 ? S 0:00 /usr/bin/perl -w /usr/libexec/webmin/openvpn/create_v
692 ? Rs 0:00 sshd: root@pts/0
694 pts/0 Ss 0:00 -bash
1323 pts/0 T 0:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-tables
1395 pts/0 R+ 0:00 ps x
dev includes # kill -9 1323
dev includes # /etc/init.d/mysqld start
Starting MySQL: [ OK ]
[1]+ Killed mysqld_safe --skip-grant-tables
dev includes # mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
dev includes # mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.1.20

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

mysql>