Use whereis can not find the file in the Mac

In the Mac I installed the mysqlclient, use whereis can not find the mysql_config, but use which I can find, why use the whereis can not find it?

aircraftdeMacBook-Pro:bin ldl$ whereis mysql_config
aircraftdeMacBook-Pro:bin ldl$ which mysql_config
/usr/local/mysql/bin//mysql_config

whereis uses a hardcoded list of paths to search. which uses your PATH.

/usr/local/mysql/bin isn't a standard location for binaries, so whereis doesn't search there. Presumably you've added that folder to your path (or the installer did), which means when which searches through your path folders, it finds it.

You can print the list of paths whereis searches by running the following:

$ sysctl user.cs_path
user.cs_path: /usr/bin:/bin:/usr/sbin:/sbin

Whereas your $PATH will generally have many more components. You can print your PATH with:

$ echo $PATH