mysqladmin -u root password NEWPASSWORD is the standard command used to set the root password the first time, when no password has yet been assigned to the account. Once a password is already set, this same bare syntax will fail (MySQL will reject the connection attempt), and you instead need to supply the existing password with -p — so it isn't a general-purpose 'change password' command for an account that already has one.