I followed all of that except I had to use mysqld instead of mysql in all the commands.
It update the rows with the new password but it still won't connect:
Code:
[root myscripts]# /etc/init.d/mysqld stop
Stopping MySQL: [ OK ]
[root myscripts]# mysqld_safe --skip-grant-tables &
[1] 17981
[root myscripts]# Starting mysqld daemon with databases from /var/lib/mysql
[root myscripts]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
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='mypswd' where User='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 3 Changed: 0 Warnings: 0
mysql> update user set password='mypswdtest' where User='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> update user set password='mypswd' where User='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root myscripts]# /etc/init.d/mysqld stop
STOPPING server from pid file /var/run/mysqld/mysqld.pid
110405 13:57:35 mysqld ended
Stopping MySQL: [ OK ]
[1]+ Done mysqld_safe --skip-grant-tables
[root myscripts]# /etc/init.d/mysqld start
Starting MySQL: [ OK ]
[root myscripts]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root myscripts]# mysql -u root -p mypswd
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root myscripts]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root myscripts]#
I also tried this version instead for mysqld:
http://www.cyberciti.biz/faq/mysql-r...root-password/
and get this error:
[root myscripts]# Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysqld/mysqld.pid
110405 14:05:35 mysqld ended