Fix: zsh: command not found: mysql (Mac XAMPP)

If you have installed XAMPP on your Mac and have started the service of MySQL, but when you try to connect to the database service via the Terminal, you get "zsh command not found MySQL", well the reason is you have not set the PATH variable.

Steps for the fix:

    • Make sure that the MySQL and Apache service is running and that you can able to access the PHPMyAdmin via a web browser on localhost.
    • Now go to the Terminal app and move to /Applications folder.
    • Next, move to the XAMPP folder and then the bin folder.
    • You should be able to see the MySQL binary file here, just do a PWD and copy the path.
      % pwd
    • Now add this path to the PATH environment variable:
      export PATH="/Applications/XAMPP/bin:$PATH"
    • Try to connect to MySQL via console now and it should work.
      % mysql -u root -p
fix - zsh command not found mySQL

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap