On Windows, the default Connector/Python installation location is
C:\Python
,
where X.Y
\Lib\site-packages\X.Y
is the Python version you
used to install the connector.
On Unix-like systems, the default Connector/Python installation location is
/
,
where prefix
/pythonX.Y
/site-packages/prefix
is the location where
Python is installed and X.Y
is the
Python version. See
How
installation works in the Python manual.
The C Extension is installed as
_mysql_connector.so
in the
site-packages
directory, not in the
mysql/connector
directory.
Depending on your platform, the installation path might differ from the default. If you are not sure where Connector/Python is installed, do the following to determine its location. The output here shows installation locations as might be seen on macOS:
$> python
>>> from distutils.sysconfig import get_python_lib
>>> print get_python_lib() # Python v2.x
/Library/Python/2.7/site-packages
>>> print(get_python_lib()) # Python v3.x
/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages
To test that your Connector/Python installation is working and able to connect to MySQL Server, you can run a very simple program where you supply the login credentials and host information required for the connection. For an example, see Section 5.1, “Connecting to MySQL Using Connector/Python”.