import mysql.connector ImportError: No module named connector

user2767144 picture user2767144 · Sep 11, 2013 · Viewed 9.8k times · Source

1) sudo dpkg -i mysql-connector-python_1.0.12-1ubuntu12.04_all.deb

2) sudo dpkg -i mysql-utilities_1.3.5-1debian6.0_all.deb

(Reading database ... 50871 files and directories currently installed.)
Preparing to replace mysql-utilities 1.3.5 (using mysql-utilities_1.3.5-1debian6.0_all.deb) ...
Unpacking replacement mysql-utilities ...
postrm script for mysql-utilities
foundpython2.7
/opt/bitnami/python/lib/python2.7/site-packages
Setting up mysql-utilities (1.3.5) ...
postinst script for mysql-utilities
python2.7
found
python2.7
/opt/bitnami/python/lib/python2.7/site-packages
Processing triggers for man-db ...

(will supply parameter when it works )

3) trying to run mysqlrplcheck:

$ mysqlrplcheck
Traceback (most recent call last):
  File "./mysqlrplcheck", line 38, in <module>
    from mysql.utilities.common.server import check_hostname_alias
  File "/opt/bitnami/python/lib/python2.7/site-packages/mysql/utilities/common/server.py", line 29, in <module>
    import mysql.connector
ImportError: No module named connector

It does not find mysql.connector. How do I configure this?

Answer

jaynp picture jaynp · Mar 31, 2015

user2767144 solved the problem by editing:

/usr/local/lib/python2.7/dist-packages/mysql/__init__.py

and adding:

from pkgutil import extend_path
path = extend_path(path, name)