Error when trying to set Admin password in MySQL

I'm trying to set an admin password for MySQL using the following command:

$ /usr/local/mysql/bin/mysqladmin -u root -p new_password

But, I get the following error message?

/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'

What should I do to set the admin password?

Thanks.

That's not the command to set the root password, just the command to login with mysqladmin and run the command new_password (which probably isn't a command at all).

To set the root password in mysql, login as root with mysql -uroot -p, then follow this syntax to change the password.

If you do not have the current root password you'll need to follow this procedure to reset it. It involves running the mysql daemon in a special 'safe mode'.

Also, by default mysql does not assign a password to the root user. i.e. it's empty.

mysql -u root

:smiley: