I will tell you how:
e.g. to:
~/opt/mysql/8.0.22
Maybe use dbdeployer
for this (see other post)
Note: This step is at your own risk, it's not recommended.
MYSQL_DIR="~/opt/mysql/8.0.22"
ln -s $MYSQL_DIR/lib/libmysqlclient.21.dylib /usr/local/lib/libmysqlclient.21.dylib
ln -s $MYSQL_DIR/lib/libcrypto.1.1.dylib /usr/local/lib/libcrypto.1.1.dylib
ln -s $MYSQL_DIR/lib/libssl.1.1.dylib /usr/local/lib/libssl.1.1.dylib
perl Makefile.PL --mysql_config=$MYSQL_DIR/bin/mysql_config
make
make install
Make sure mysql_config is in your path, and that's it! DBD::mysql will now build normally.