0

I'm attempting to install MySQL-python on OSX so a program I'm writing can talk to our work database to run and get back query results.

I've run into this error explaining that there is a missing mysql_config somewhere. I've come across some other StackOverflow answers but they are geared toward Linux environments.

I've also done a brew install mysql but brew link mysql is failing. I suspect the issue might being right here.

Collecting mysql-python
/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading MySQL-python-1.2.5.zip (108kB)
    100% |████████████████████████████████| 110kB 1.8MB/s
    Complete output from command python setup.py egg_info:
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/private/tmp/pip-build-ev74Js/mysql-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-ev74Js/mysql-python
5
  • It might be easier to build and install from source code. Commented Jan 12, 2016 at 2:00
  • What worked for me was downloading from pypi (pypi.python.org/pypi/mysql-connector-python/2.0.4), after unzipping I manually copied the mysql/ dir to site-packages/, then ran setup.py Commented Jan 12, 2016 at 2:05
  • What is the error message you get with brew link mysql? Commented Jan 12, 2016 at 2:13
  • For brew link mysql I get Linking /usr/local/Cellar/mysql/5.6.24... Error: Could not symlink bin/innochecksum /usr/local/bin is not writable Commented Jan 12, 2016 at 4:02
  • check your mysql path is being added Commented Apr 10, 2018 at 9:32

1 Answer 1

2

It appears you don't have write permissions for /usr/local, resulting in homebrew failing to link. If you're on OS X 10.11+ there's a good chance that it's reset all the permissions, which you need to change in order to remedy the issue; first try letting homebrew fix things:

Troubleshooting Homebrew:

  1. Run brew update (twice).
  2. Run brew doctor and fix all the warnings.

Take Ownership:

If things fail with permissions errors, check the permissions in /usr/local, or perhaps use:

sudo chown -R $(whoami) /usr/local

Homebrew Troubleshooting document | El Capitan and Homebrew document

Sign up to request clarification or add additional context in comments.

2 Comments

I'm on 10.10.1 -- /usr is root:wheel right now. Not sure setting the owner to myself is a good idea honestly as this is root owned directory.
Please read the Homebrew documentation — It explains in more detail what I've already summarized. The directory in question is /usr/local, not the top level /usr.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.