Fail to connection to MySQL Server through the terminal by new password

In the book, “Build Your Own Database Driven Web Site Using PHP & MySQL”, 4th edition, I’ve reached page 32 with MySQL, Apache and PHP installed and localhost is well. I’m having difficulty setting a new password to connect to the Mysql server. here is what I’m seeing from page 45-47:

Tony-iMac-Kicks-Ass:~ impetusmedia$ mysqladmin -u root -p password “sax$2u%nessabase”
Enter password:
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@‘localhost’ (using password: NO)’
Tony-iMac-Kicks-Ass:~ impetusmedia$

What could be my problem? I’ve reinstalled and configured everything for the third time.

Note: My old installation was with Mamp, I’ve decide to uninstall that and do the individual installs.

I think you misunderstood the sample code.
Try this:


mysqladmin -u root -p sax$2u%nessabase

If you type “mysqladmin” with no parameters the help explains it.

I tried that also but the book says "mysqladmin -u root -p password “newpassword” followed by replace newpassword with whatever password you’d like to use for your mysql server. Also could there be an issue with the name of the command. The video course indicates that I must use mysqli while the book says mysql. The book and the video course seem to contradict each other.

Do you have root access? You may need to prepend “sudo” to your command

A quick GOOGLE search yielded this:
According to MySQL documentation,

shell> mysqladmin password “my new password”
As of MySQL 5.5.3, the new password can be omitted following the password command. In this case, mysqladmin prompts for the password value, which enables you to avoid specifying the password on the command line. Omitting the password value should be done only if password is the final command on the mysqladmin command line. Otherwise, the next argument is taken as the password.