Python - Connect to MySQL Database with PyCharm

Поделиться
HTML-код
  • Опубликовано: 27 апр 2021
  • In this video we will be connecting to a MySQL database with Python. Specifically, we will be using the PyCharm IDE to work with Python and MySQL Workbench to work with MySQL. We will also learn about Python MySQL Connectors and how Python connects to a database.
    How to install PyCharm:
    • Install PyCharm & Pyth...
    How to install MySQL and MySQL Workbench:
    • How to install MySQL 8...
    Link to learn MySQL Connector connect() function:
    dev.mysql.com/doc/connector-p...
    👩‍💻 Download Code 👨‍💻
    wittcode.com
    🛜 Download My Chrome Extension 🛜
    chromewebstore.google.com/det...
    💻 Compare Laptop Specs 💻
    laptopspectable.com
    🔴 Rare Pokemon Cards ⚪️
    rarepokemoncards.com
    👻 90s Nostalgia 👻
    goosebumpsforsale.com

Комментарии • 148

  • @user-wj5fq2in2y
    @user-wj5fq2in2y 2 года назад +4

    Потратил весь день и не нашел нормального объяснения. Но твое видео - топ, сразу все понятно и работает! Спасибо

  • @user-px9xo5qq5i
    @user-px9xo5qq5i 4 месяца назад +1

    Mistrzu. Wielkie dzięki. Przeczytałem komentarze i tam jest już wszystko napisane co sam chciałbym napisać. Pozdrawiam, trzymaj się jesteś w porządku.

  • @lechallday2999
    @lechallday2999 Год назад +13

    After hours of searching i've come across the perfect video on how to install a mysql connector in python. I had no clue that finding an explanation for this would be so hard to find. Thank you so much sir

  • @munyaivhuthuhawe8829
    @munyaivhuthuhawe8829 3 года назад +18

    Man I'd just like to thank you. I've been searching and searching for the past 3 days for this and this content hear just saved my life and my project. You are awesome ✅😁😁

    • @WittCode
      @WittCode  3 года назад +1

      Hey Munyai! That's great to hear! Glad I could help! 😀

    • @KiranSachi
      @KiranSachi 2 года назад

      6

    • @balajinaveen9090
      @balajinaveen9090 Год назад

      @@WittCode you say correct bro👍

  • @GentianLloshi
    @GentianLloshi 2 года назад +3

    Thanks for this useful video! It helped me a lot. Keep up the good work!

  • @tokelo2547
    @tokelo2547 Год назад +1

    Yo...Great video. I have been tirelessly searching for a video like yours. Thank you very much.
    Next one may you please make us one for a streamlit web app using both locally hosted and on cloud both on MySQL databases!
    Thank you!!

  • @sanketkadam9600
    @sanketkadam9600 Год назад

    thank you man. it makes me real easy to connect with mysql.

  • @KashyapSharma0
    @KashyapSharma0 11 месяцев назад

    Simple and concise.. Thank you so much!!

  • @h.d.4644
    @h.d.4644 2 года назад

    Thank you so much. Ive been looking for a solution on StackOverflow for hours and this is the first approach that immediately worked.

  • @johannesallgaier5722
    @johannesallgaier5722 2 года назад +1

    Great work, thanks for sharing your knowledge!

  • @caratzu2556
    @caratzu2556 2 месяца назад

    Thank you so much for this amazing video I have been searching all over the internet and finally found this video 🍀

  • @salvador8164
    @salvador8164 Год назад +1

    why this man only have 5.82k subscriber man he should have millions thank you man keep on helping thank you very much

  • @mctaggart3
    @mctaggart3 2 года назад +1

    Thanks a lot, really helpful!

  • @TacticalSommelier
    @TacticalSommelier 3 года назад +3

    Thank you! Great walkthrough. Much appreciated bro

    • @WittCode
      @WittCode  3 года назад

      Of course! Thank you for watching! 🤠

  • @stevekituku8783
    @stevekituku8783 8 месяцев назад

    This video is beyond GREAT!!

  • @meghanam7550
    @meghanam7550 3 года назад +4

    I was searching from 1 week for this video. This video saved me. A big thanks to this man. I watched more than 15 video from past 1 week but it was not explained in this way.

    • @WittCode
      @WittCode  3 года назад +2

      Awesome to hear Meghana! Thanks for the kind words! 😁

  • @georgeimus6102
    @georgeimus6102 6 месяцев назад

    You just saved me your the greatest

  • @ochiengwilliam
    @ochiengwilliam 2 года назад +3

    I have no doubt subscribing to your channel and liking your video.
    Thank you very much

    • @WittCode
      @WittCode  2 года назад +1

      That's great to hear! Thanks K'Ochieng! 😀

  • @jaxlone997
    @jaxlone997 Год назад

    witty stuff for sure. thanks a lot

  • @tsruturaj
    @tsruturaj Год назад

    Thank you so much it helped me a lot , saved my time !

  • @omthorve7928
    @omthorve7928 Год назад

    Bro the video you gave in description for mysql download thanks for that it was really helpful

  • @FarmBoyTech
    @FarmBoyTech 7 месяцев назад

    Hey man big thanks to you

  • @le_monsieur_stan4801
    @le_monsieur_stan4801 2 года назад

    Super video, thank you for your advices. Great job (y)

  • @saifm5908
    @saifm5908 Год назад

    Thank you! Was really helpful video.

  • @pranayr1718
    @pranayr1718 Год назад

    Good Work!!! Thank You

  • @rutikasonak
    @rutikasonak Год назад

    Great video. Thanks a lot!

  • @navamisubhash9638
    @navamisubhash9638 2 года назад

    Thanks! great video!!!

  • @yasith6370
    @yasith6370 2 года назад +1

    Love you man

  • @loucok
    @loucok Год назад

    best solution I found
    Thank you bro!

  • @jampulaharshavardhan7577
    @jampulaharshavardhan7577 Год назад

    Thank you so much. i subscribed your channel now.

  • @captainmustard1
    @captainmustard1 2 года назад

    that was just amazing, you re awesome !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @yasith6370
    @yasith6370 2 года назад

    I nearly think to quit programming by a small problem but you video helped a lot😘

  • @arunisto
    @arunisto 2 года назад

    Awesome man. Thank you!

    • @WittCode
      @WittCode  2 года назад +1

      Of course Arun! Thank you for watching! 😀

  • @joannwatu7603
    @joannwatu7603 2 года назад +3

    Thank you. This was very helpful

    • @WittCode
      @WittCode  2 года назад +1

      Thanks so much for watching Joan! 😀

  • @mambacreatives
    @mambacreatives 5 месяцев назад +1

    Amazing tutorial

  • @am_subhadip
    @am_subhadip 2 года назад

    I BIG THANKYOU BRO. You are amazing

  • @ompatel7316
    @ompatel7316 Год назад

    nice video dude👍👍💖

  • @mohanraj.j7647
    @mohanraj.j7647 2 года назад

    Thank you so much bro . this video is helpful and carrier growth Thank you so much

  • @balajinaveen9090
    @balajinaveen9090 Год назад

    Thank you so much bro.. really understand bro..👍👍

  • @mdfaheemuddin2031
    @mdfaheemuddin2031 3 года назад +1

    That was very, very, very, very...... helpful

    • @WittCode
      @WittCode  3 года назад +1

      Great to hear! Thanks for watching! 🤠

  • @S_Nayana
    @S_Nayana 26 дней назад

    Perfect!!!

  • @manasamopuri2859
    @manasamopuri2859 2 года назад

    thank you so much.. it was a very explanation. Thank you once again

    • @WittCode
      @WittCode  2 года назад

      Of course Manasa! Thank you for watching! 😃

  • @mishel0312
    @mishel0312 2 года назад

    thank you man ! helped me a lot

    • @WittCode
      @WittCode  2 года назад

      Anytime Mishel! Thanks for watching! 😁

  • @YuriyBaragin
    @YuriyBaragin Год назад

    Thanks bro 😀

  • @sandeeptadikamalla2721
    @sandeeptadikamalla2721 2 года назад +1

    Thank u for wonderful explanation !

    • @WittCode
      @WittCode  2 года назад

      Of course Sandeep! Thanks for watching! 😀

  • @amineaoukach1267
    @amineaoukach1267 2 года назад

    thank u a looot bro

  • @sudhirdheple4752
    @sudhirdheple4752 2 года назад

    Thank you sir 🙏

  • @Shephard_
    @Shephard_ 3 года назад +1

    Thanks for this video really helped with my project.

    • @WittCode
      @WittCode  3 года назад

      That's great to hear! Thanks for watching! 😁

  • @abdiellara7816
    @abdiellara7816 Год назад

    thank you!

  • @yashbeniwal9981
    @yashbeniwal9981 2 года назад

    Thanks❣

  • @darkodour5031
    @darkodour5031 2 года назад

    thanks man

  • @himalayanhighlander.8621
    @himalayanhighlander.8621 Год назад

    Thanks 🙏🙏

  • @akashsonar7161
    @akashsonar7161 3 года назад +1

    Appreciated your efforts brother thank you

    • @WittCode
      @WittCode  3 года назад

      Hey Akash! Thanks for watching! 😃

  • @swarupmazumder
    @swarupmazumder Год назад

    Thank you

  • @lydiasaraswati517
    @lydiasaraswati517 2 года назад

    Thank you so much. I was struggling for a few days and this video has helped me out

  • @mahdisafarpour1860
    @mahdisafarpour1860 10 месяцев назад

    that was awsome

  • @gautamprajapati2423
    @gautamprajapati2423 2 года назад

    Dose pycharm community addition work for this

  • @abdullahfahad6388
    @abdullahfahad6388 7 месяцев назад

    Will it work for pycharm community version?

  • @wyndhamwoo2851
    @wyndhamwoo2851 3 года назад +1

    Hi, great tutorial. I just want to ask if this can work when on other computers. For example if I want to use it in a public app. Or can it only work on my computer?

    • @WittCode
      @WittCode  3 года назад

      Hey there! Do you mean if you created an app with this database connection and had other users use it? If so, yeah it should work depending on how you deployed it!

    • @wyndhamwoo2851
      @wyndhamwoo2851 3 года назад

      @@WittCodeIt works locally on my pycharm but I want it to be able to work publicly online for anyone through github. But I am not sure if it will work publicly online as only I have the mysql database on my computer. If it can work though, do you know a way i can deploy it with github together with my code, do I need to upload mysql file and if so how would I go about it? If not should I just change it to not local host for it to work for anyone on any computer and how will i got about that?

    • @wyndhamwoo2851
      @wyndhamwoo2851 3 года назад

      @@WittCode It works locally on my pycharm but I want it to be able to work publicly online for anyone through github. But I am not sure if it will work publicly online as only I have the mysql database on my computer. Should I make it not localhost for it to work on github?

  • @GiannisBak
    @GiannisBak 28 дней назад

    thanks a lot

  • @abdulrauof5736
    @abdulrauof5736 Год назад

    Thnx mahn

  • @amelhadfi388
    @amelhadfi388 3 года назад +1

    Do you have a video on how to load MySQL data to Hadoop?
    I have officially connected MySQL using this video (thanks by the way, helped a lot).

    • @WittCode
      @WittCode  3 года назад +1

      Hey Amel! Thanks for watching! Sadly I do not as I am not too familiar with Hadoop. 😄

  • @dhualshammaa2062
    @dhualshammaa2062 2 года назад

    do you have more example for mysql with python

  • @yo-ds8ip
    @yo-ds8ip 2 года назад

    Thanks.

  • @pratapreddy9820
    @pratapreddy9820 Год назад

    Where can I find the connect function under mysql module ?

  • @GABRIEL1030
    @GABRIEL1030 Год назад

    ¡Gracias!

  • @nicolawing5197
    @nicolawing5197 3 года назад

    Cool, you helped me, with my problem

    • @WittCode
      @WittCode  3 года назад

      That's great to hear Nicola! Glad I could help! 😀

  • @code6233
    @code6233 3 года назад +2

    Thank you very much ❤️

    • @WittCode
      @WittCode  3 года назад

      Anytime! Thanks for watching! 😃

  • @umitech287
    @umitech287 2 года назад +2

    Very helpful 👍

    • @WittCode
      @WittCode  2 года назад +1

      Thanks so much Umair!

  • @xilin1063
    @xilin1063 2 года назад

    Thanks for your great video! I want to ask is there a method to mandate all the users like google's Firebase? Say, someone registers an account on another computer, and then his account status can be checked on my computer.

  • @omniayahia723
    @omniayahia723 3 года назад

    thank you, keep going

    • @WittCode
      @WittCode  3 года назад

      Thanks for watching Omnia! 😀

  • @alansteeve2235
    @alansteeve2235 Год назад

    can u to the same video for MAC OS connection

  • @info_lish3065
    @info_lish3065 3 года назад

    i did like yr video keep going

    • @WittCode
      @WittCode  3 года назад

      Thanks so much! 😃

  • @dillondonovan9074
    @dillondonovan9074 3 года назад +2

    Hey WittCode, i have a question? I assume you are professional and im curious where you work / what you do.

    • @WittCode
      @WittCode  3 года назад +7

      Hey Dillon good to hear from you again! I am a full stack developer in javascript but I have only recently started. I actually did chemistry in college and I taught myself this stuff!

  • @SantiagoParreli
    @SantiagoParreli 2 года назад

    Hola buen día
    Estoy usando mysql.connector pero en consola me muestra el usario y password en la consola, cómo se deshabilita esto ya que obviamente no quiero mostrar las credenciales porque esa salida la voy a guardar en un archivo, ya lo Googlie y no encuentro cómo

  • @Andy-kr8jh
    @Andy-kr8jh 3 года назад

    thanks man

    • @WittCode
      @WittCode  3 года назад

      No problem Andy! Thanks for watching! 🤠

  • @Python_Bacon
    @Python_Bacon 2 года назад

    I appreciate the video but mysql that I have on my computer looks nothing like yours and does not have the same options.

  • @mohamedehsan8017
    @mohamedehsan8017 3 года назад

    Hello there, I have another issue.
    I had to reinstall PyCharm on a different laptop but can't see any packages in the python interpreter and I can't even add any due to the plus button being greyed out.

    • @WittCode
      @WittCode  3 года назад +1

      Hey good to hear from you again Mohamed! I haven't experienced this personally but you might have to actually add the actual online repository to pycharm.
      1.) Go to Settings
      2.) Project interpreter
      3.) Click the + sign on top right edge
      4.) Go to manage repositories,
      5.) Press the + Sign, then add pypi.python.org/pypi
      6.) Press Ok
      Let me know if this helps!

    • @mohamedehsan8017
      @mohamedehsan8017 3 года назад

      @@WittCode thanks a lot this helped a lot. Thanks again.

  • @layronjancedrics.9260
    @layronjancedrics.9260 2 года назад

    Do you have a crud tutorial of this?

  • @this.is.teresa
    @this.is.teresa 11 месяцев назад

    pycharm output says the above exception was direct cause of the following exception.

  • @user-ul6tf3dp9v
    @user-ul6tf3dp9v Год назад

    No way for me to connect... it keeps throwing at me the same crap. Traceback (most recent call last):
    File "C:\Users\flosr\pyver\py311\Lib\site-packages\mysql\connector\connection_cext.py", line 291, in _open_connection
    self._cmysql.connect(**cnx_kwargs)
    _mysql_connector.MySQLInterfaceError: Can't open named pipe to host: . pipe: MySQL (2)

  • @dax_dc2608
    @dax_dc2608 10 месяцев назад

    I did exactly what you did but it is giving me some error now can you fix please?

  • @wyndhamwoo2851
    @wyndhamwoo2851 3 года назад

    Hey I am having some trouble can you help me please?

  • @ramazankaratay2294
    @ramazankaratay2294 Год назад

    ALLAH RAZI OLSUN

  • @sanjeevkumar-iw2lz
    @sanjeevkumar-iw2lz 2 года назад

    I am getting this=mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported
    what I should do?
    I am not able to solve this issue from week. please help me.

    • @WittCode
      @WittCode  2 года назад +1

      Hey Sanjeev! Did you install the correct mysql connector at the beginning of the video? I have heard of this issue when the wrong connector is installed.

    • @sanjeevkumar-iw2lz
      @sanjeevkumar-iw2lz 2 года назад +1

      @@WittCode yes, I have installed the same connector which you have said.

    • @WittCode
      @WittCode  2 года назад

      @@sanjeevkumar-iw2lz Hmmm so another solution I can see is adding this to your connection constructor: auth_plugin='mysql_native_password'

    • @sanjeevkumar-iw2lz
      @sanjeevkumar-iw2lz 2 года назад

      @@WittCode yeahh, it worked, thanks.but can you please explain, what it is and why I have to do it.?

    • @WittCode
      @WittCode  2 года назад

      @@sanjeevkumar-iw2lz Great to hear! Which version of MySQL are you using? caching_sha2_password is the default authentication mechanism for MySQL 8.0. If what you are connecting to (here it is your MySQL server) uses a different form of authentication, then you need to use the auth_plugin argument to specify this!

  • @wyndhamwoo2851
    @wyndhamwoo2851 3 года назад

    I also have this error mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on '%-.100s:%u' (%s) (Warning: %u format: a number is required, not str)

    • @WittCode
      @WittCode  3 года назад

      Hey there! If you look online it seems that this could be an issue with your port number. Make sure the port you are specifying is the correct one. The default for MySQL is 3306 but you could have made it a different number when setting up your MySQL server. Let me know if this works!

    • @wyndhamwoo2851
      @wyndhamwoo2851 3 года назад

      @@WittCode hi it worked thanks

    • @WittCode
      @WittCode  3 года назад

      @@wyndhamwoo2851 Great to hear!

    • @wyndhamwoo2851
      @wyndhamwoo2851 3 года назад

      @@WittCode Do you know any way to import a database file (.db) into pycharm or to make one, perhaps from a csv file, so that it can be used like this.
      self.connection = sqlite3.connect("example.db")

    • @wyndhamwoo2851
      @wyndhamwoo2851 3 года назад

      @@WittCode I just want to ask if this can work when on other computers. For example if I want to use it in a public app. Or can it only work on my computer?

  • @nurselikaya9479
    @nurselikaya9479 3 года назад

    Hello, firstly of all, ı liked your video but how can I send data from pycharm to sql

    • @WittCode
      @WittCode  3 года назад +1

      Hey Nurseli thanks for watching! Do you mean like instead of retrieving data from the database you want to insert data?

    • @nurselikaya9479
      @nurselikaya9479 3 года назад

      @@WittCode Yes exactly

    • @nurselikaya9479
      @nurselikaya9479 3 года назад

      @@WittCode can you take a video about like this

    • @WittCode
      @WittCode  3 года назад

      @@nurselikaya9479 I will definitely be making more videos on interacting with SQL and python but to do that it would simply be changing the SQL statement from where I said "select * from" to an SQL insert statement! If you look at W3 schools insert statement you'll learn the basics of how to do it 🤠

  • @adeshabhang44
    @adeshabhang44 3 года назад +1

    Hi buddy can you help me with my code

    • @WittCode
      @WittCode  3 года назад +1

      Hey Adesh! Sure what seems to be the problem?

  • @Life-zx5wp
    @Life-zx5wp 2 года назад

    please make your text bigger, i can't see your screen clearly

    • @WittCode
      @WittCode  2 года назад +1

      Hey there! Thanks for the feedback I could definitely zoom in a little more! 😀

  • @udaymahajan1015
    @udaymahajan1015 Год назад

    thank you !

  • @appuva423
    @appuva423 2 года назад

    thanks bro😀