Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)
edited by

I'm trying to get a Python script to run on the Linux server which I'm connected to via ssh. The script uses mysqldb. 

python setup.py install

I also have all the other components that I need, but the moment I try to install MySQL dB through setuptools like below:

python setup.py install

I am getting the following error report related to the mysql_config command. 

sh: mysql_config: command not found
Traceback (most recent call last):
  File "setup.py", line 15, in <module>
    metadata, options = get_config()
  File "/usr/lib/python2.5/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "/usr/lib/python2.5/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

Did anyone else got the same error and if so how you had resolved it ?

1 Answer

0 votes
by (12.7k points)
edited by

I did try a lot of things, but these below set of commands finally worked for me.

1. Install mysql.

brew install mysql

2. brew unlink mysql

3. brew install mysql-connector-c

4. Add the mysql bin folder to PATH

export PATH=/usr/local/Cellar/mysql/8.0.11/bin:$PATH

5. mkdir /usr/local/Cellar/lib/

6. Create a symlink 

sudo ln -s /usr/local/Cellar/mysql/8.0.11/lib/libmysqlclient.21.dylib /usr/local/Cellar/lib/libmysqlclient.21.dylib

7. brew reinstall openssl

8. Finally, install mysql-client

LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ pip install mysqlclient

Interested in SQL ? Check out this SQL Certification by Intellipaat.

For more information visit :

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...