• Friday , 20 October 2017

Python Programming Tutorial – 48: Install MySql Connector for Python

Code Canyon



In this tutorial we’ll begin our discussion on using python to interact with MySql databases. We’ll download and install the MySql connector for python and …

Original source

3d Ocean

Related Posts

21 Comments

  1. asantamarian
    September 16, 2017 at 02:21

    talk too much… please don't talk!!

  2. zia shahid
    September 16, 2017 at 02:21

    sir what would be the procedure if we dont use the localhost ,what changes can be done in setting up the sqlworkbench?? kindly help !!

  3. devarajakhil matta
    September 16, 2017 at 02:21

    I'm in python 3.6 but when I download 3.4 v MySql it's saying can't find 3.4 python

  4. James Thaz
    September 16, 2017 at 02:21

    change title to Python 2.X

  5. Cosi Melchor Nolasco
    September 16, 2017 at 02:21

    Thank u!! it Works

  6. Leon Safal
    September 16, 2017 at 02:21

    does wampserver mysql works on it

  7. varun gupta
    September 16, 2017 at 02:21

    Hi! I am using python 2.7 and I installed the SQL connector for the same. But when I run the command
    conn=mysql.connector.connect(user='root',password='varun',host='localhost')
    I am getting the following error message. could you please help me!?
    Error: Can't connect to MySQL server on 'localhost:3306' (10061 No connection could be made because the target machine actively refused it)

  8. Wihecami
    September 16, 2017 at 02:21

    I'm on Windows 10 (x64), python 3.5, here you can download mysql client http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient

    Worked for me: mysqlclient-1.3.7-cp35-cp35m-win32.whl

  9. RizkianAmalia
    September 16, 2017 at 02:21

    what should I do next if I found this error when I try to import mysql.connector?
    >>> import mysql.connector

    Traceback (most recent call last):
    File "<pyshell#0>", line 1, in <module>
    import mysql.connector
    ImportError: No module named mysql.connector

  10. reza mohaghegh
    September 16, 2017 at 02:21

    can anyone helps why it doesnt work and install properly on mac?

  11. Dr. S Neogi
    September 16, 2017 at 02:21

    hi, i have installed mysql connector but i can only import mysql.connector for python 2.7 which comes with mac, though i have python3.5, but in python3.5 i get an error ImportError: no module named 'mysql'… please suggest for python3.5… many thanks

  12. Rahul Singh
    September 16, 2017 at 02:21

    i am using python 3.5..the mysql connector for python 3.5 hasn't been released yet..what should i do now??

  13. Lata Sati
    September 16, 2017 at 02:21

    thanks, really helpful !!!

  14. Jonathan Peralta
    September 16, 2017 at 02:21

    thanks! you are the best friend!

  15. mama_lojzka
    September 16, 2017 at 02:21

    Thank you. Very useful video.

  16. Power Money Respect
    September 16, 2017 at 02:21

    Great video. Thanks!

  17. Ted
    September 16, 2017 at 02:21

    "python v3.4 not found".. what should to do to make it find it. I downloaded python3.4 exactly where it is expected

  18. Ted
    September 16, 2017 at 02:21

    how and where to create the table? the one you named as test.

  19. Musthafa Ma
    September 16, 2017 at 02:21

    when i try to connect m getting the following errors 

    >>> conn=mysql.connector.connect(user='root',password='',host='localhost')
    Traceback (most recent call last):
      File "C:Python34libsite-packagesmysqlconnectornetwork.py", line 467, in open_connection
        self.sock.connect(sockaddr)
    ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<pyshell#24>", line 1, in <module>
        conn=mysql.connector.connect(user='root',password='',host='localhost')
      File "C:Python34libsite-packagesmysqlconnector__init__.py", line 159, in connect
        return MySQLConnection(*args, **kwargs)
      File "C:Python34libsite-packagesmysqlconnectorconnection.py", line 129, in _init_
        self.connect(**kwargs)
      File "C:Python34libsite-packagesmysqlconnectorconnection.py", line 454, in connect
        self._open_connection()
      File "C:Python34libsite-packagesmysqlconnectorconnection.py", line 417, in _open_connection
        self._socket.open_connection()
      File "C:Python34libsite-packagesmysqlconnectornetwork.py", line 470, in open_connection
        errno=2003, values=(self.get_address(), _strioerror(err)))
    mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (10061 No connection could be made because the target machine actively refused it)

  20. Wisdombylearningtruth :)
    September 16, 2017 at 02:21

    will it work for 3.4 ?

  21. Mo Ka
    September 16, 2017 at 02:21

    Thank you for your helpful tutorial. I am wondering if mysql connector works the same as mysqlDB. Could you help me through that?

Leave A Comment

You must be logged in to post a comment.