[root@localhost bin]# ./mysql -uroot -p12345
进入 mysql 安装的目录
cd /usr/local/mysql/bin
[root@localhost bin]# ./mysqld_safe --user=root --skip-grant-tables --skip-networking &
[1] 3818
[root@localhost bin]# 111105 07:30:32 mysqld_safe Logging to '/usr/local/mysql/var/localhost.localdomain.err'.
111105 07:30:32 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
# ./mysql -uroot mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.48-log Source distribution
mysql> update user set password=password('12345') where user='root' ;
Query OK, 3 rows affected (0.05 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye