The first thing to know is what kind of shell you use for Mac OS x, using commands
Echo $SHELL
If the output is: CSH or TCSH, then you are using C Shell.
If the output is: bash,sh,zsh, then your use may be a variant of the Bourne shell.
Before Mac OS X 10.2, the default is C Shell.
The default is Bourne Shell after Mac OS X 10.3.
Open terminal, input: cd ~
Will enter the ~ folder
Then type: sudo vim. bash_profile
Enter the root user password to execute. sudo uses the root user to modify the environment variable file.
Enter at the bottom of the document: Export Path=${path}:/usr/local/mysql/bin
Then ESC exits the insert state and enters at the bottom: Wq save to exit.
Input: source. bash_profile
Enter execution, run environment variable.
Then enter MySQL and you can use it.
Add the MySQL command to the MAC environment variable in the terminal directly with the MySQL command