I have just installed MySQL from rpm to my RedHat server.

After installation, it prompted to set password for 'root' and 'ns.mymachine.com'

I set the password for the root.

But when I tries to set the password for 'ns.mymachine.com' it says:-

mysqladmin: connect to server at 'ns.mymachine.com' failed
error: 'Access denied for user: 'root@ns' (Using password: YES)'

I am using the following command to set password:-

/usr/bin/mysqladmin -u root -h ns.mymachine.com -p password 'new-password'