A better solution than using old MySQL versions:
Connect as root using the following command:
mysql -u root -p mysql
After this the prompt will ask you for a password which is set to 'root' as default in newer versions of MySQL. Like this:
-------------------------------------------------------------------
C:\mysql\bin>mysql -u root -p mysql
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 4.0.20a-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql;
-------------------------------------------------------------------
You can set the password for individual databases by using the 'update' command:
-------------------------------------------------------------------
update mysql.user set password='wrox' where user='root'
-------------------------------------------------------------------
This will change 'wrox' as a password for root user.
(Thx to
anand_smart@http://forums.devshed.com)