Python MySQL Tutorial - Setup & Basic Queries (w/ MySQL Connector)

Поделиться
HTML-код
  • Опубликовано: 22 янв 2025

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

  • @TechWithTim
    @TechWithTim  5 лет назад +76

    Let me know what you want from this series!

    • @Pa-ow1nj
      @Pa-ow1nj 5 лет назад +4

      That was helpful thanks, I got an arduino working with an temperature sensor who is able to send the data to a mysql database realy looking forward for this season :) !!

    • @floydian25
      @floydian25 5 лет назад +3

      Some complex queries as well that are asked in interviews

    • @Krishna42570
      @Krishna42570 5 лет назад +1

      Plss solvee leetcode problemsss and hackerrankkk problemsss

    • @bensmith9253
      @bensmith9253 5 лет назад

      This is great. Looking forward to the next one. 👍

    • @maciejmyslinski7820
      @maciejmyslinski7820 5 лет назад +1

      Import data from files e.g. csv etc.

  • @desislavaandreeva4359
    @desislavaandreeva4359 5 лет назад +47

    I use MySQL in my daily work and combining with python as extra knowledge outside of the office will definitely help me jumping in a better job! Thank you Tim, you are a wizard!

    • @bigfatcrab
      @bigfatcrab 4 года назад +1

      wrong, he has a fairies. Timmy Turner has a fairy oddparents

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

    This is a fucking gold mine, this guy explains shit with just enough depth to invoke thought but simple enough to retain. Thank you!

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

    I HAVE SEARCHED FOR THOUSANDS OF VIDEOS...AND I DIDNT UNDERSTAND....YOURS HELPED ME A LOT....THANKS TIM!

  • @virgil6892
    @virgil6892 5 лет назад +101

    In case you get an error along the lines of:
    "line 191, in get_auth_plugin
    "Authentication plugin '{0}' is not supported".format(plugin_name)) mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported" it's because you don't have the right version of the python connector. you can get the right version with the following command
    *pip install MySQL-connector-python*

    • @shouyuanchen3741
      @shouyuanchen3741 5 лет назад +24

      I wan to add one more point, if u just do "pip install mysql-connector-python" doesnt work, first uninstall mysql-connector and uninstall mysql-connector-python via "pip uninstall mysql-connector " and via"pip uninstall mysql-connector-python" and then install mysql-connector-python. have fun gl

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

      thanks a lot this really help, i ma been struggle of this prob

    • @JorgeMirandaRN
      @JorgeMirandaRN 4 года назад +1

      ​@@shouyuanchen3741 thanks a lot (y) it was so helpful

    • @Frank_UK_was_taken
      @Frank_UK_was_taken 4 года назад +1

      I love you

    • @j.r.7693
      @j.r.7693 4 года назад

      Thank you

  • @elliamorse1442
    @elliamorse1442 5 лет назад +21

    This was a lovely introduction to your channel and I'm looking forward to watching more of your videos and completing this series on MySQL and Python!

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

    you are explaining this much more clearly and concisely than my grad professor. Thank you!

  • @alexandermread
    @alexandermread 5 лет назад +58

    Hey I got the error 'mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported' and it was because I installed 'mysql-connector' using pip instead of 'mysql-connector-python'. Just letting anybody know in case someone made the same mistake

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

    This series really helped me out! Got to submit my project tomorrow (i.e. today it is currently 1:30 am where I'm rn lol), thanks to you Tim, I can sleep now! I just can't thank you enough! Also after seeing this video I've made up my mind to take up the machine learning course you teach on FreeCodeCamp. Once again thank you so much!

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

    this was exactly what i was looking for and it was the first video i clicked on Tim the Top GUY EVERYTIME

  • @kasyapdharanikota8570
    @kasyapdharanikota8570 4 года назад +2

    thank you ; installed the whole setup without any problems after following your instructions

  • @adri4351
    @adri4351 5 лет назад +9

    This is really need! Thanks Tim! You are doing an awesome job! I think that explaining how SQL works in more depth, how to code in SQL, how to handle data (retrieve it from the server and send it to the server) using python...Those would be good ideas. Also, could you go more deep explaining how the local servers work and how can we create an online server? Thanks again man!!!

  • @merrymouse2008
    @merrymouse2008 2 года назад +4

    For all those who is still getting "ModuleNotFoundError" and tried everything, this command is what worked for me:
    python3 -m pip install mysql-connector
    I'm on Windows 10, Using Python 3.9. When I tried manually install the connector as Tim suggested, OS complained saying I had to run it as admin which I already did (no idea wtf is happened there). I hope this will save time to someone.

    • @InfinityBS
      @InfinityBS 11 месяцев назад +2

      ur literally a life saver, i couldnt find the connector download for windows anywhere on the website, i tried this command and it worked. thank you

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

    Awesome, awesome, awesome. Tim. I recently got into Python3 in the last month, and I'm in love. Your series on Selenium has help tons for my web automation program i'm trying to create. I'm looking forward to incorporating the MySQL database to this program for data management. Love your videos!
    Much love,
    Nick

  • @foxglvz6237
    @foxglvz6237 5 лет назад +3

    Damn looks like a awesome series is going on here! Greetings from FR thanks a lot, you rock man!! ♥

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

    YO shoutout for correctly calling it a hyphen and not a dash. Thank you.

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

    Thank you!! Gave me exactly what I needed to get my first connection and test done!

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

    Just a heads up if you are using a newer version of Python. When installing via pip you need to enter pip install mysql-connector-python as the way to install in this video is outdated! Finally figured it out after a good 30 minutes of searching so hopefully if you are having an issue this helps!

  • @BurmeseBlueRose
    @BurmeseBlueRose 4 года назад +1

    Лучшее видео про установку mySQL! Спасибо!
    The best video about installing mySQL! Thanks!

  • @Shadowex2000
    @Shadowex2000 3 года назад +27

    For anyone having the error:
    "mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported"
    Instead of running:
    pip install mysql-connector
    Run:
    pip install mysql-connnector-python

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

      when you install it use pip install mysql-connector-python (instead of pip install mysql-connector)

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

      After installing mysql-connector-python, how should I import it?

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

      @@klasta2167 Same as video

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

    Tim you are the best bro 😊😊

  • @DuniaDY
    @DuniaDY 5 лет назад +2

    Excellent stuff, high quality content in your videos! Thanks for putting in all the good work, Tim.

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

    What you have explained is good and also easy to undertsand.

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

    i like the way that you explain in very clear , thanks

  • @JollyAZ
    @JollyAZ 4 года назад

    Thank you Tim. Watched countless other tutorials and they are making download this and that and making re download this and that.

  • @jaimecrawford
    @jaimecrawford 4 года назад

    Thanks! This got me going with the mysql connector for python after a few failed attempts.

  • @sesha-d5b
    @sesha-d5b 3 года назад +2

    brother I'm getting this error in pycharm ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it ; could You help me here?

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

    If you get the error "AttributeError: module 'mysql' has no attribute 'connector'" even after reinstalling the connector, as Tim suggested, try modifying your python script to "import mysql.connector". At least, that worked for me (using Python 3.10, MySQL/MariaDB 10.5.15, Win 10, Atom 1.60 text editor)

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

    this was actually very helpful, thank you very much

  • @davidarnoldio3420
    @davidarnoldio3420 11 месяцев назад +1

    hi tim but mine doesn't have the developer default option what should i choose then?

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

    What playlist is the this part of?

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

    This was helpful - thank you!

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

    Thanks pal, very useful video tutorial, go ahead.

  • @m.shiqofilla4246
    @m.shiqofilla4246 3 года назад

    Bro in 2:57 there are many products to install, but when i try that it only appear 4, all of them are connector, no workbench, no MySql server, no MySql Shell, router, etc, is that because i use 32 bit system computer? Can MySQL work completely (with all the products) in 32 bit (x86) system? Please answer it friends...

  • @EmmanuelBanda-r7o
    @EmmanuelBanda-r7o Год назад +1

    Am getting an error Saying Authentic plugging 'caching_sha_passwords' is not supported

  • @Bbycakes281
    @Bbycakes281 19 дней назад

    curious on how I would do this on Mac? I have tried an install and does not work - I do have sql by oracle in my code vs - but I don't know what to do for the create connection tab

  • @suryayadav2520
    @suryayadav2520 5 лет назад +8

    How can actually connect a front end tech with mysql db

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

    Hey Tim, @TechWithTim
    I didn’t find developer default option under the setup type 2:42 , what can I do?
    Thanks

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

    It would be heloful iuf you linked the next video at the end of this one.

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

    pip install mysql-connector-python
    if you get the "mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported" error.

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

    This is a really good tutorial, thanks for making it

  • @Kig_Ama
    @Kig_Ama 4 года назад

    12:17 As I see u r not using pycharm. I am using pycharm. The problem I have is the sql queries used with the mysql connector don't have any color highlighting and language injection. How can I solve the problem?

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

    I would suggest first find an overview on MySQL and write some basic queries on its workbench and then watching this series is recommended for not to get lost. ⚠
    good videos buy the way.

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

    what if I wanna connect to a database not on my computer what should I put in "host"?

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

      Would be the address and port where the database is located. It could be on the domain, check your host.

  • @shreejanshrestha1931
    @shreejanshrestha1931 4 года назад +10

    2020: mysql-connector will not work its deprecated, instead install mysql-connector-python.
    if you have installed mysql-connector previously, do pip uninstall mysql-connector and then install one with -python at last.

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

    Authentication plugin 'caching_sha2_password' is not supported
    I have this issue. What does it mean ? :/

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

      pip uninstall mysql-connector... then pip install mysql-connector-python .. I googled it on stack overflow. Had same problem. Works now.

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

    Great stuff, thanks!

  • @מנדיקציר
    @מנדיקציר 2 года назад

    Thanks a lot! you did it very simple and very clear, it was helpfull!

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

    So, question. What are you using to write this code in? Its not the workbench. Is this a standard text editor or what are you using? How would you run it to see if you get errors?

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

    Thank you Tim, great video, clear and easy to follow. Very pleasant!
    I know this is a while after you posted this video, but by chance have you also come upon Python in your past job searches or interviews? Do they ask computer science type coding questions by chance related to data structures, algorithms, time complexity of programs, etc either in a tex editor or onto a white board? I have to learn similar technologies but for working in biology, I was told I would have to give a presentation. (maybe of code or other projects) Thank you!

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

    easy to follow. very helpful

  • @Allen-by6ci
    @Allen-by6ci 3 года назад

    Excellent video

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

    Why do I not get developer default option i know version is newer but had same problem on tech with Alex The Analyst his has developer default and it's from 11 months ago

  • @jidhinjustin214
    @jidhinjustin214 4 года назад +2

    I am getting this error
    mysql.connector.errors.DatabaseError: 2003 (HY000): Can't connect to MySQL server on 'localhost' (61)

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

    If you run into the same problem I did. Python3.10 wouldn't connect and manually I couldnt connect SQL so I had to go into the terminal and run "python3.10 -m pip install mysql-connector-python" that allowed me to get everthing working since even as an ADMIN I wasnt able to install the connector.

  • @hanskalaran3337
    @hanskalaran3337 4 года назад

    Thanks, it was helpful for me. : )

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

    Would be nice a video just explaining the connection in python. good video

  • @hamadler2898
    @hamadler2898 4 года назад +1

    friend, why i can't connect my MySQL to my python program on (KALI LINUX)
    is that even possible to connect MySQL to python on KALI LINUX?
    because i couldn't find any tutorial videos about that problem

  • @erich.3247
    @erich.3247 4 года назад

    Great Video!

  • @BlazinEdit
    @BlazinEdit 5 лет назад

    So hyped for this series! I was recently searching on how to work with DB, hopefully I can follow you. Is there some GUI interface that can display all the relation between tables in our database?

    • @caelim3524
      @caelim3524 4 года назад

      Pretty much any python GUI module should work

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

    That was great. Thank you.

  • @SkyFly19853
    @SkyFly19853 5 лет назад +1

    Getting better and better...
    I am also learning about mySQL...
    So, mySQL and Python... a nice combination...

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

    Great video thanks! :)

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

    Hi Tim..why I have only MySQL Server in the list of configuration?

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

    I used pip install mysql-connector-python / when I try to run it in visual studio code, it doesn't work. It says it's uploaded but still not luck... Any answers???

  • @m0rphene3
    @m0rphene3 4 года назад +1

    I can import mysql in python but unable to import mysql connector.its showing no module named mysql.connector ; mysql is not a package.help me I've successfully installed mysql connector but still.

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

      did you get an answer on this one? im having the same issue

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

    when i typed python it opened windows store. what should i do. i have already installed python from its official website

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

    mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported
    always getting this error
    don't know what to do

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

      Run mysql installer. Reconfigure msql server. In Authentication method, choose "Use legacy authentication method".

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

      @@toughastank thank u ily

  • @delikanli1825
    @delikanli1825 10 месяцев назад +1

    is this still relevant?
    I mean "up to date" can we still follow along this course?

    • @JoeyChittick
      @JoeyChittick 8 месяцев назад +2

      I've followed the steps of this video as well as many small variations of it from old forums.
      I'm wondering if they stopped supporting the Python connector on Windows OS for some reason.
      Windows is not an available option on the download page linked in this video.
      Using "pip3 install mysql-connector-python", everything seems to work, but in VS Code I'm getting errors that seem to indicate there is a problem.
      Could be an issue with my code but I've followed a few tutorials and always get the same error.

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

    Is the connector installed by the mysql installer different from one installed by command prompt?

  • @truetalktamil8383
    @truetalktamil8383 2 месяца назад +1

    it is not showing an option called developer default

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

    I deleted the MySQL server 8.017 and then installed the package again but it did not have the server again. What solution can u give me?
    cause when I installed the Mysql server community edition but it does not have the package as I previously deleted it.

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

    Traceback (most recent call last):
    File "", line 1, in
    import mysql.connector
    ModuleNotFoundError: No module named 'mysql'
    this is comming plz anyone help i have installed the .dmg file many times still the problrm remains.:-(

    • @louisbloom5505
      @louisbloom5505 4 года назад

      pip install mysql

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

      I'm having the same error as well. Did you have any luck here?

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

    after following your stated steps i am getting an error saying 'no mysql module'. can u please help me out i need it urgently

  • @kylephillips1974
    @kylephillips1974 Месяц назад

    idk what to do anymore cause I can't download mysql connector python

  • @vagifk2864
    @vagifk2864 4 года назад +1

    Hello Tim, have you ever tried to work with Amazon Aurora, does it work similarly to MySQL?

  • @technology-myanmar1096
    @technology-myanmar1096 2 года назад

    hey can you help me how can I host that database

  • @jasonclough8892
    @jasonclough8892 4 года назад +1

    I can't find my server in the MySQL Workbench?...

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

    hello sir, currently i am trying to execute some mysql query using python but i am facing some issues please help

  • @usama57926
    @usama57926 5 лет назад +1

    can we use xampp here???

  • @shreyasreedhar2068
    @shreyasreedhar2068 5 лет назад

    very helpful! thanks so much :)

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

    Can use mysql workbench as server ? Please help me. Thank you

  • @lulcy95
    @lulcy95 9 месяцев назад

    Will any of these work if I use Visual Studio Code instead?

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

    Nice but how do you encrypt your credentials on the local file?

  • @dhulfiqaralshammaa8189
    @dhulfiqaralshammaa8189 4 года назад +1

    I got this error ... can you let me know how to fix it
    Traceback (most recent call last):
    File "C:/Users/Eng.Dhulfiqar/Desktop/mysql_test.py", line 1, in
    import mysql.connector
    ModuleNotFoundError: No module named 'mysql'

    • @andrewn211
      @andrewn211 4 года назад

      try to reinstall it but specify a version like this: pip install mysql-connector-python=={8.0.11} (make sure its equal to the newest version)
      and by the way make sure your not in a conda environment or something like that make sure to be in the right environnment i hope this helps

    • @kasaimarie-claire-yui3356
      @kasaimarie-claire-yui3356 4 года назад

      I have the same problem and i can't find out why. I have read on a website that it is possible that using phpmyadmin and trying to access mysql trhough python is not possible because phpmyadmin is protected against those kind of manipulation.
      But i am not sure. could you tell me if you found out how to solve your problem?
      Regards

    • @pranathipolisetty1006
      @pranathipolisetty1006 4 года назад

      @@kasaimarie-claire-yui3356 i'm facing the same problem i cant proceed further because i keep getting this no module found error have u got any solution?

    • @kasaimarie-claire-yui3356
      @kasaimarie-claire-yui3356 4 года назад

      @@pranathipolisetty1006 I added port = 3080 or another number but I don t remember in my Python script to connect mysql

  • @warehamtown
    @warehamtown 4 года назад

    Got right to the end and when I put 'mycursor=dB. Cursor()' it comes up with "mysql connection not available ".... Any advice?? I can't creat and open a database after that/ do the next steps

    • @therealwaytodoeverything5531
      @therealwaytodoeverything5531 4 года назад

      try "pip install mysql-connector-python" in cmd and if ur using terminal on mac try "pip3 install mysql-connector-python"

  • @randy4443
    @randy4443 5 лет назад

    If I am making the database withinin python. For example. I make a dictionary of students and their grades, how would I insert this into mysql? Would I need to manually student in my sql?

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

    It is showing
    AttributeError : module 'mysql.connector' has no attribute 'connect'
    What should I do now..?
    Anybody pls help😥😥

  • @vaibhavgawde11
    @vaibhavgawde11 4 года назад

    thank you so much man

  • @gautamdhar150
    @gautamdhar150 4 года назад +1

    i am getting an error in the connect line
    "C:\Users\Gautam\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mysql\connector\__init__.py", line 179, in connect
    return MySQLConnection(*args, **kwargs)
    can someone pls help

    • @therealwaytodoeverything5531
      @therealwaytodoeverything5531 4 года назад

      try using "pip install mysql-connector-python" in terminal/cmd if u are using terminal on mac then say "pip3" instead of "pip"

    • @gautamdhar150
      @gautamdhar150 4 года назад

      ​@@therealwaytodoeverything5531 I already tried it.

  • @keshan-spec
    @keshan-spec 5 лет назад

    why does this look so complicated? i mean cant we use phomyadmin's mysql server? or do we specifically need to install the mysql server like you did? any thoughts?
    great video btw.

  • @tagoreji2143
    @tagoreji2143 4 года назад

    thanks a lot sir
    when i completed my installation process i got a message that this is not meant for your OS ,So do I get any problems in the future

  • @hosseindr.askari6161
    @hosseindr.askari6161 Год назад

    Thanks a lot buddy :-)

  • @imcnx1563
    @imcnx1563 4 года назад

    what about if I want to use an online database like PHP MyAdmin?

  • @petermuwanguzi3787
    @petermuwanguzi3787 5 лет назад

    i liked it thou i prefer postgres to mysql so can you please do a video on python and postgres

  • @B1SQ1T
    @B1SQ1T 2 года назад +4

    For those who did pip install mysql-connector and still can't get import mysql.connector to work, try doing pip install mysql-connector-python
    I'm on python 3.10.6 so I'm not too sure if there was some update between this video coming out and now but that did it for me

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

      If this still doesn't work for you try:
      pip uninstall mysql-connector
      pip uninstall mysql-connector-python
      then:
      pip install mysql-connector
      just installing on top of the other package didn't work for me

  • @MrJaredGTR
    @MrJaredGTR 5 лет назад

    Thanks so much!

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

    Did anyone get this message.
    C:\Users\Butters>activate
    'activate' is not recognized as an internal or external command,
    operable program or batch file.

  • @quandoeuforrico
    @quandoeuforrico 4 года назад

    What Python editor are you using?

    • @sfvarandas
      @sfvarandas 4 года назад +1

      It seems "Sublime". www.sublimetext.com/

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

    Thanks man