macos mysql

How to have “mysql” command on Mac OS?

I was given a code repo which requires mysql in command line.

I am using Mac OS 10.11

First, I installed MySQL Community Server from and install it by running the PKG file.

After that, I opened System Preferences to start MySQL Server.

Then, I tried to execute

/usr/local/mysql/bin/mysql -uroot

and there is an error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

How could I have mysql in command line?