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

Поделиться
HTML-код
  • Опубликовано: 21 июл 2024
  • Learn how to use MySQL and SQL with python. In this series I will show you how to use the python mysql connector to create tables, insert data and work with a MySQL database.
    MySQL is a relational database management system. It is a great tool to learn how to use and will allow you to demonstrate your experience with RDBMS to future employers. (Employers usually require you know SQL!!)
    Links:
    MySQL: dev.mysql.com/downloads/insta...
    Python Connector: dev.mysql.com/downloads/conne...
    Playlist: • Python MySQL Tutorial ...
    ◾◾◾◾◾
    💻 Enroll in The Fundamentals of Programming w/ Python
    tech-with-tim.teachable.com/p...
    📸 Instagram: / tech_with_tim
    🌎 Website techwithtim.net
    📱 Twitter: / techwithtimm
    ⭐ Discord: / discord
    📝 LinkedIn: / tim-rusci. .
    📂 GitHub: github.com/techwithtim
    🔊 Podcast: anchor.fm/tech-with-tim
    💵 One-Time Donations: www.paypal.com/donate/?token=...
    💰 Patreon: / techwithtim
    ◾◾◾◾◾◾
    ⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡
    Tags:
    - Tech With Tim
    - Python Tutorials
    - Python MySQL
    - MySQL Tutorial Python
    #Python #MySQL #SQL

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

  • @TechWithTim
    @TechWithTim  4 года назад +68

    Let me know what you want from this series!

    • @Pa-ow1nj
      @Pa-ow1nj 4 года назад +2

      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 4 года назад +2

      Some complex queries as well that are asked in interviews

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

      Plss solvee leetcode problemsss and hackerrankkk problemsss

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

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

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

      Import data from files e.g. csv etc.

  • @virgil6892
    @virgil6892 4 года назад +92

    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 4 года назад +22

      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

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

      I love you

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

      Thank you

  • @elliamorse1442
    @elliamorse1442 4 года назад +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!

  • @desislavaandreeva4359
    @desislavaandreeva4359 4 года назад +46

    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

  • @alexandermread
    @alexandermread 4 года назад +43

    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

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

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

  • @adri4351
    @adri4351 4 года назад +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!!!

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

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

  • @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

  • @vudhanthineeraja1904
    @vudhanthineeraja1904 Год назад +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!

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

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

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

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

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

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

  • @danedmdan
    @danedmdan 2 года назад +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!

  • @Shadowex2000
    @Shadowex2000 2 года назад +26

    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 2 года назад

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

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

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

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

      @@klasta2167 Same as video

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

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

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

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

  • @suryayadav2520
    @suryayadav2520 4 года назад +8

    How can actually connect a front end tech with mysql db

  • @metalflames777
    @metalflames777 5 месяцев назад

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

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

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

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

    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

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

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

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

    this was actually very helpful, thank you very much

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

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

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

    This is a really good tutorial, thanks for making it

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

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

  • @user-ev7vh5cm1v
    @user-ev7vh5cm1v 2 года назад

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

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

    This was helpful - thank you!

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

    very helpful! thanks so much :)

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

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

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

    Thanks, it was helpful for me. : )

  • @keshan-spec
    @keshan-spec 4 года назад

    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.

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

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

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

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

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

    Thanks pal, very useful video tutorial, go ahead.

  • @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?

  • @merrymouse2008
    @merrymouse2008 Год назад +3

    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 5 месяцев назад +1

      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

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

    That was great. Thank you.

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

    Great stuff, thanks!

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

    easy to follow. very helpful

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

    Great video thanks! :)

  • @shreejanshrestha1931
    @shreejanshrestha1931 3 года назад +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.

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

    Great Video!

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

    Thanks so much!

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

    Only guide that i managed to get it connected, developer option seems to not be there anymore so i just installed full and its working okay for me

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

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

  • @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!

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

    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?

  • @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

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

    Thanks man

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

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

  • @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)

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

    i would like to learn how to create a database to track each client's info with pictures and have a SMS sending program connected to this database. Thank you!

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

    thank you so much man

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

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

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

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

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

    Please help me with this question.
    I am having a mysql database in my VPS which has 100k max_connection.
    And i am having around 90k users per second in my app, so can anyone please suggest me what should i do.
    Should i switch from mysql to Hadoop, Cassandra or other big database, or should i keep using mysql.
    I have searched but didn't get a good answer that i can rely on.
    Please help me i am having problems and less time. Please help me.

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

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

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

    Excellent video

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

    Thank you!

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

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

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

    thank you Tim

  • @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.

  • @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

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

    Thanks a lot buddy :-)

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

    What playlist is the this part of?

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

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

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

    thanks!

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

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

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

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

  • @user-lm8ig7os2k
    @user-lm8ig7os2k 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?

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

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

  • @kaizen8492
    @kaizen8492 Год назад +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.

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

    Can you please connect my sql and Java in eclipse ide

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

    a lot thank you

  • @user-se6jv5lw2o
    @user-se6jv5lw2o Год назад +1

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

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

    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?

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

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

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

    more of this please

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

    Hello! I just found your channel and it is great! I have problem with the import. If I run >>> import mysql I have no problem. If I run >>> import mysql.connector, it gives me an error: ModuleNotFoundError: No module named 'mysql.connector' .....any ideas??? thanks!

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

    Thank you Tim

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

    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.

  • @krsingh.shubham
    @krsingh.shubham 4 года назад

    how to connect front end and backend mysql

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

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

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

    Hey Tim, how do i get to know my user name? I forgot what I took on at the time of the install.
    Therefore, Python is showing me an error that the access was denied even though i used the correct password. Thanks !!

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

      I guess you can lookup that in the mysql database in the table users, but am not sure. Btw the passwords there are *definitely* hashed

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

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

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

    Thanks for the tutorial. I have a question, is putting the password in plain text the only way?

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

      You might also use a configuration file that you dont commit to git(hub) or give to your client

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

    can we use xampp here???

  • @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???

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

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

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

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

  • @tishyaghosh6977
    @tishyaghosh6977 3 года назад +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 3 года назад

      pip install mysql

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

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

  • @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 3 года назад

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

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

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

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

    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...

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

    hey can you help me how can I host that database

  • @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.

  • @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.

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

    Pls continue this tutorial using peewee or SQLAlchemy orm

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

    Can't connect to MySQL server on 'localhost:3306' (13 An attempt was made to access a socket in a way forbidden by its access permissions): Help..