How to install mysql-connector via pip










17














I use sqlalchemy to access MySQL in my Python project. sqlalchemy's conf is like this:



dialect=mysql
driver=mysqlconnector


So I need to install the Python module mysql connector via pip. Any help?










share|improve this question























  • The official package name now is mysql-connector-python, so use pip install mysql-connector-python
    – YaOzI
    Nov 13 '18 at 2:00
















17














I use sqlalchemy to access MySQL in my Python project. sqlalchemy's conf is like this:



dialect=mysql
driver=mysqlconnector


So I need to install the Python module mysql connector via pip. Any help?










share|improve this question























  • The official package name now is mysql-connector-python, so use pip install mysql-connector-python
    – YaOzI
    Nov 13 '18 at 2:00














17












17








17


6





I use sqlalchemy to access MySQL in my Python project. sqlalchemy's conf is like this:



dialect=mysql
driver=mysqlconnector


So I need to install the Python module mysql connector via pip. Any help?










share|improve this question















I use sqlalchemy to access MySQL in my Python project. sqlalchemy's conf is like this:



dialect=mysql
driver=mysqlconnector


So I need to install the Python module mysql connector via pip. Any help?







python sqlalchemy mysql-connector






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 2 '17 at 21:28









Michael

3,41333857




3,41333857










asked Sep 24 '15 at 6:06









CodeforCodefor

6722520




6722520











  • The official package name now is mysql-connector-python, so use pip install mysql-connector-python
    – YaOzI
    Nov 13 '18 at 2:00

















  • The official package name now is mysql-connector-python, so use pip install mysql-connector-python
    – YaOzI
    Nov 13 '18 at 2:00
















The official package name now is mysql-connector-python, so use pip install mysql-connector-python
– YaOzI
Nov 13 '18 at 2:00





The official package name now is mysql-connector-python, so use pip install mysql-connector-python
– YaOzI
Nov 13 '18 at 2:00













6 Answers
6






active

oldest

votes


















44














If loading via pip install mysql-connector and leads an error Unable to find Protobuf include directory then this would be useful pip install mysql-connector==2.1.4






share|improve this answer






















  • Requirements mysql-connector (version >= 2.2.3) requires Protobuf C++ (version >= 2.6.0) see github.com/sanpingz/mysql-connector
    – Codefor
    Jun 14 '17 at 5:20










  • I have edited and added to stackoverflow.com/questions/46215390/…
    – Partha Sen
    Sep 14 '17 at 9:37


















19














pip install mysql-connector


Last but not least,You can also install mysql-connector via source code



Download source code from:
https://dev.mysql.com/downloads/connector/python/






share|improve this answer






















  • related pages: pypi.python.org/pypi/mysql-connector github.com/sanpingz/mysql-connector
    – Codefor
    Jun 14 '17 at 5:21


















7














execute following command from your terminal



sudo pip install --allow-external mysql-connector-python mysql-connector-python





share|improve this answer




















  • This worked for me, but I have no idea why "allow external" would be important.
    – Stephen Ostermiller
    Dec 19 '17 at 18:11










  • This worked for me too. However, you probably shouldn't use sudo for this.
    – swdon
    Jan 26 '18 at 7:56










  • Worked for me :D (Without sudo) Thanks.
    – Jannunen
    Feb 26 '18 at 14:39


















5














To install the official MySQL Connector for Python, please use the name mysql-connector-python:



pip install mysql-connector-python



Some further discussion, when we pip search for mysql-connector at this time (Nov, 2018), the most related results shown as follow:



$ pip search mysql-connector | grep ^mysql-connector
mysql-connector (2.1.6) - MySQL driver written in Python
mysql-connector-python (8.0.13) - MySQL driver written in Python
mysql-connector-repackaged (0.3.1) - MySQL driver written in Python
mysql-connector-async-dd (2.0.2) - mysql async connection
mysql-connector-python-rf (2.2.2) - MySQL driver written in Python
mysql-connector-python-dd (2.0.2) - MySQL driver written in Python



  • mysql-connector (2.1.6) is provided on PyPI when MySQL didn't provide their official pip install on PyPI at beginning (which was inconvenient). But it is a fork, and is stopped updating, so



    pip install mysql-connector


    will install this obsolete version.



  • And now mysql-connector-python (8.0.13) on PyPI is the official package maintained by MySQL, so this is the one we should install.






share|improve this answer






























    0














    First install setuptools



    sudo pip install setuptools


    Then install mysql-connector



    sudo pip install mysql-connector


    If using Python3, then replace pip by pip3






    share|improve this answer




























      0














      For Windows



      pip install mysql-connector



      For Ubuntu /Linux



      sudo apt-get install python3-pymysql






      share|improve this answer




















        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "1"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32754461%2fhow-to-install-mysql-connector-via-pip%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        6 Answers
        6






        active

        oldest

        votes








        6 Answers
        6






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        44














        If loading via pip install mysql-connector and leads an error Unable to find Protobuf include directory then this would be useful pip install mysql-connector==2.1.4






        share|improve this answer






















        • Requirements mysql-connector (version >= 2.2.3) requires Protobuf C++ (version >= 2.6.0) see github.com/sanpingz/mysql-connector
          – Codefor
          Jun 14 '17 at 5:20










        • I have edited and added to stackoverflow.com/questions/46215390/…
          – Partha Sen
          Sep 14 '17 at 9:37















        44














        If loading via pip install mysql-connector and leads an error Unable to find Protobuf include directory then this would be useful pip install mysql-connector==2.1.4






        share|improve this answer






















        • Requirements mysql-connector (version >= 2.2.3) requires Protobuf C++ (version >= 2.6.0) see github.com/sanpingz/mysql-connector
          – Codefor
          Jun 14 '17 at 5:20










        • I have edited and added to stackoverflow.com/questions/46215390/…
          – Partha Sen
          Sep 14 '17 at 9:37













        44












        44








        44






        If loading via pip install mysql-connector and leads an error Unable to find Protobuf include directory then this would be useful pip install mysql-connector==2.1.4






        share|improve this answer














        If loading via pip install mysql-connector and leads an error Unable to find Protobuf include directory then this would be useful pip install mysql-connector==2.1.4







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Sep 14 '17 at 9:31

























        answered Jun 8 '17 at 13:10









        Partha SenPartha Sen

        1,070913




        1,070913











        • Requirements mysql-connector (version >= 2.2.3) requires Protobuf C++ (version >= 2.6.0) see github.com/sanpingz/mysql-connector
          – Codefor
          Jun 14 '17 at 5:20










        • I have edited and added to stackoverflow.com/questions/46215390/…
          – Partha Sen
          Sep 14 '17 at 9:37
















        • Requirements mysql-connector (version >= 2.2.3) requires Protobuf C++ (version >= 2.6.0) see github.com/sanpingz/mysql-connector
          – Codefor
          Jun 14 '17 at 5:20










        • I have edited and added to stackoverflow.com/questions/46215390/…
          – Partha Sen
          Sep 14 '17 at 9:37















        Requirements mysql-connector (version >= 2.2.3) requires Protobuf C++ (version >= 2.6.0) see github.com/sanpingz/mysql-connector
        – Codefor
        Jun 14 '17 at 5:20




        Requirements mysql-connector (version >= 2.2.3) requires Protobuf C++ (version >= 2.6.0) see github.com/sanpingz/mysql-connector
        – Codefor
        Jun 14 '17 at 5:20












        I have edited and added to stackoverflow.com/questions/46215390/…
        – Partha Sen
        Sep 14 '17 at 9:37




        I have edited and added to stackoverflow.com/questions/46215390/…
        – Partha Sen
        Sep 14 '17 at 9:37













        19














        pip install mysql-connector


        Last but not least,You can also install mysql-connector via source code



        Download source code from:
        https://dev.mysql.com/downloads/connector/python/






        share|improve this answer






















        • related pages: pypi.python.org/pypi/mysql-connector github.com/sanpingz/mysql-connector
          – Codefor
          Jun 14 '17 at 5:21















        19














        pip install mysql-connector


        Last but not least,You can also install mysql-connector via source code



        Download source code from:
        https://dev.mysql.com/downloads/connector/python/






        share|improve this answer






















        • related pages: pypi.python.org/pypi/mysql-connector github.com/sanpingz/mysql-connector
          – Codefor
          Jun 14 '17 at 5:21













        19












        19








        19






        pip install mysql-connector


        Last but not least,You can also install mysql-connector via source code



        Download source code from:
        https://dev.mysql.com/downloads/connector/python/






        share|improve this answer














        pip install mysql-connector


        Last but not least,You can also install mysql-connector via source code



        Download source code from:
        https://dev.mysql.com/downloads/connector/python/







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited May 3 '17 at 2:24









        dkb

        1,14211324




        1,14211324










        answered Sep 24 '15 at 6:06









        CodeforCodefor

        6722520




        6722520











        • related pages: pypi.python.org/pypi/mysql-connector github.com/sanpingz/mysql-connector
          – Codefor
          Jun 14 '17 at 5:21
















        • related pages: pypi.python.org/pypi/mysql-connector github.com/sanpingz/mysql-connector
          – Codefor
          Jun 14 '17 at 5:21















        related pages: pypi.python.org/pypi/mysql-connector github.com/sanpingz/mysql-connector
        – Codefor
        Jun 14 '17 at 5:21




        related pages: pypi.python.org/pypi/mysql-connector github.com/sanpingz/mysql-connector
        – Codefor
        Jun 14 '17 at 5:21











        7














        execute following command from your terminal



        sudo pip install --allow-external mysql-connector-python mysql-connector-python





        share|improve this answer




















        • This worked for me, but I have no idea why "allow external" would be important.
          – Stephen Ostermiller
          Dec 19 '17 at 18:11










        • This worked for me too. However, you probably shouldn't use sudo for this.
          – swdon
          Jan 26 '18 at 7:56










        • Worked for me :D (Without sudo) Thanks.
          – Jannunen
          Feb 26 '18 at 14:39















        7














        execute following command from your terminal



        sudo pip install --allow-external mysql-connector-python mysql-connector-python





        share|improve this answer




















        • This worked for me, but I have no idea why "allow external" would be important.
          – Stephen Ostermiller
          Dec 19 '17 at 18:11










        • This worked for me too. However, you probably shouldn't use sudo for this.
          – swdon
          Jan 26 '18 at 7:56










        • Worked for me :D (Without sudo) Thanks.
          – Jannunen
          Feb 26 '18 at 14:39













        7












        7








        7






        execute following command from your terminal



        sudo pip install --allow-external mysql-connector-python mysql-connector-python





        share|improve this answer












        execute following command from your terminal



        sudo pip install --allow-external mysql-connector-python mysql-connector-python






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 24 '15 at 7:16









        Zaheer KhorajiyaZaheer Khorajiya

        384110




        384110











        • This worked for me, but I have no idea why "allow external" would be important.
          – Stephen Ostermiller
          Dec 19 '17 at 18:11










        • This worked for me too. However, you probably shouldn't use sudo for this.
          – swdon
          Jan 26 '18 at 7:56










        • Worked for me :D (Without sudo) Thanks.
          – Jannunen
          Feb 26 '18 at 14:39
















        • This worked for me, but I have no idea why "allow external" would be important.
          – Stephen Ostermiller
          Dec 19 '17 at 18:11










        • This worked for me too. However, you probably shouldn't use sudo for this.
          – swdon
          Jan 26 '18 at 7:56










        • Worked for me :D (Without sudo) Thanks.
          – Jannunen
          Feb 26 '18 at 14:39















        This worked for me, but I have no idea why "allow external" would be important.
        – Stephen Ostermiller
        Dec 19 '17 at 18:11




        This worked for me, but I have no idea why "allow external" would be important.
        – Stephen Ostermiller
        Dec 19 '17 at 18:11












        This worked for me too. However, you probably shouldn't use sudo for this.
        – swdon
        Jan 26 '18 at 7:56




        This worked for me too. However, you probably shouldn't use sudo for this.
        – swdon
        Jan 26 '18 at 7:56












        Worked for me :D (Without sudo) Thanks.
        – Jannunen
        Feb 26 '18 at 14:39




        Worked for me :D (Without sudo) Thanks.
        – Jannunen
        Feb 26 '18 at 14:39











        5














        To install the official MySQL Connector for Python, please use the name mysql-connector-python:



        pip install mysql-connector-python



        Some further discussion, when we pip search for mysql-connector at this time (Nov, 2018), the most related results shown as follow:



        $ pip search mysql-connector | grep ^mysql-connector
        mysql-connector (2.1.6) - MySQL driver written in Python
        mysql-connector-python (8.0.13) - MySQL driver written in Python
        mysql-connector-repackaged (0.3.1) - MySQL driver written in Python
        mysql-connector-async-dd (2.0.2) - mysql async connection
        mysql-connector-python-rf (2.2.2) - MySQL driver written in Python
        mysql-connector-python-dd (2.0.2) - MySQL driver written in Python



        • mysql-connector (2.1.6) is provided on PyPI when MySQL didn't provide their official pip install on PyPI at beginning (which was inconvenient). But it is a fork, and is stopped updating, so



          pip install mysql-connector


          will install this obsolete version.



        • And now mysql-connector-python (8.0.13) on PyPI is the official package maintained by MySQL, so this is the one we should install.






        share|improve this answer



























          5














          To install the official MySQL Connector for Python, please use the name mysql-connector-python:



          pip install mysql-connector-python



          Some further discussion, when we pip search for mysql-connector at this time (Nov, 2018), the most related results shown as follow:



          $ pip search mysql-connector | grep ^mysql-connector
          mysql-connector (2.1.6) - MySQL driver written in Python
          mysql-connector-python (8.0.13) - MySQL driver written in Python
          mysql-connector-repackaged (0.3.1) - MySQL driver written in Python
          mysql-connector-async-dd (2.0.2) - mysql async connection
          mysql-connector-python-rf (2.2.2) - MySQL driver written in Python
          mysql-connector-python-dd (2.0.2) - MySQL driver written in Python



          • mysql-connector (2.1.6) is provided on PyPI when MySQL didn't provide their official pip install on PyPI at beginning (which was inconvenient). But it is a fork, and is stopped updating, so



            pip install mysql-connector


            will install this obsolete version.



          • And now mysql-connector-python (8.0.13) on PyPI is the official package maintained by MySQL, so this is the one we should install.






          share|improve this answer

























            5












            5








            5






            To install the official MySQL Connector for Python, please use the name mysql-connector-python:



            pip install mysql-connector-python



            Some further discussion, when we pip search for mysql-connector at this time (Nov, 2018), the most related results shown as follow:



            $ pip search mysql-connector | grep ^mysql-connector
            mysql-connector (2.1.6) - MySQL driver written in Python
            mysql-connector-python (8.0.13) - MySQL driver written in Python
            mysql-connector-repackaged (0.3.1) - MySQL driver written in Python
            mysql-connector-async-dd (2.0.2) - mysql async connection
            mysql-connector-python-rf (2.2.2) - MySQL driver written in Python
            mysql-connector-python-dd (2.0.2) - MySQL driver written in Python



            • mysql-connector (2.1.6) is provided on PyPI when MySQL didn't provide their official pip install on PyPI at beginning (which was inconvenient). But it is a fork, and is stopped updating, so



              pip install mysql-connector


              will install this obsolete version.



            • And now mysql-connector-python (8.0.13) on PyPI is the official package maintained by MySQL, so this is the one we should install.






            share|improve this answer














            To install the official MySQL Connector for Python, please use the name mysql-connector-python:



            pip install mysql-connector-python



            Some further discussion, when we pip search for mysql-connector at this time (Nov, 2018), the most related results shown as follow:



            $ pip search mysql-connector | grep ^mysql-connector
            mysql-connector (2.1.6) - MySQL driver written in Python
            mysql-connector-python (8.0.13) - MySQL driver written in Python
            mysql-connector-repackaged (0.3.1) - MySQL driver written in Python
            mysql-connector-async-dd (2.0.2) - mysql async connection
            mysql-connector-python-rf (2.2.2) - MySQL driver written in Python
            mysql-connector-python-dd (2.0.2) - MySQL driver written in Python



            • mysql-connector (2.1.6) is provided on PyPI when MySQL didn't provide their official pip install on PyPI at beginning (which was inconvenient). But it is a fork, and is stopped updating, so



              pip install mysql-connector


              will install this obsolete version.



            • And now mysql-connector-python (8.0.13) on PyPI is the official package maintained by MySQL, so this is the one we should install.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 13 '18 at 13:10

























            answered Nov 13 '18 at 1:58









            YaOzIYaOzI

            3,43822233




            3,43822233





















                0














                First install setuptools



                sudo pip install setuptools


                Then install mysql-connector



                sudo pip install mysql-connector


                If using Python3, then replace pip by pip3






                share|improve this answer

























                  0














                  First install setuptools



                  sudo pip install setuptools


                  Then install mysql-connector



                  sudo pip install mysql-connector


                  If using Python3, then replace pip by pip3






                  share|improve this answer























                    0












                    0








                    0






                    First install setuptools



                    sudo pip install setuptools


                    Then install mysql-connector



                    sudo pip install mysql-connector


                    If using Python3, then replace pip by pip3






                    share|improve this answer












                    First install setuptools



                    sudo pip install setuptools


                    Then install mysql-connector



                    sudo pip install mysql-connector


                    If using Python3, then replace pip by pip3







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered May 16 '18 at 19:11









                    user2459835user2459835

                    1




                    1





















                        0














                        For Windows



                        pip install mysql-connector



                        For Ubuntu /Linux



                        sudo apt-get install python3-pymysql






                        share|improve this answer

























                          0














                          For Windows



                          pip install mysql-connector



                          For Ubuntu /Linux



                          sudo apt-get install python3-pymysql






                          share|improve this answer























                            0












                            0








                            0






                            For Windows



                            pip install mysql-connector



                            For Ubuntu /Linux



                            sudo apt-get install python3-pymysql






                            share|improve this answer












                            For Windows



                            pip install mysql-connector



                            For Ubuntu /Linux



                            sudo apt-get install python3-pymysql







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Sep 24 '18 at 16:05









                            Umesh YadavUmesh Yadav

                            115




                            115



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32754461%2fhow-to-install-mysql-connector-via-pip%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                這個網誌中的熱門文章

                                Barbados

                                How to read a connectionString WITH PROVIDER in .NET Core?

                                Node.js Script on GitHub Pages or Amazon S3