I am trying to install mysql on a machine named A.
I have logged into machine B and then I ssh (secure login) to machine A from machine B and then install mysql. After downloading mysql and typing the command

mysql_install_db on RedHat Linux,

I get messages that says I need to change password for the MySQL root user by:

/usr/bin/mysqladmin -u root password 'new-password' and

/usr/bin/mysqladmin -u root -h host_name_of_machine_A password 'new-password'

when I did the above two steps, I get the error message:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'

Any Help?

Thanks a lot