Python MySQL Database Connectivity - MySQL Connector | 2023

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone let's see how to install and configure python MySQL connector let's see the installed packages I am getting a message to upgrade pip let's update it pip upgraded successfully now let's install python MySQL connector the command is PIP space install space MySQL hybrid connector hybrid python it will get installed successfully if you face similar kind of error like me then add hyphen hyphen user to the command this time it will get installed without any errors now let's connect to the mySQL database let's check the available databases we will be using the database python let's see the tables available under python database now let's fetch all the records from user table we can see there are two records now let's retrieve the records using python for this we need hostname username password database name and the query to connect the database from python in our case host name is localhost username is wrote password is root and database name is python the query is Select star from user let's save the file as constants Dot py now let's create another file on the same location as test dot py to write our code let's import the constants file first now let's import the connector from MySQL package we will create the connection object and pass all the required information to it let's create a cursor object we will call the execute method of cursor object and pass the query to it from the constants file method we will retrieve the records from the table now let's use a for Loop to print the user details at the end we should close the cursor and connection objects let's save the file and run it here we can verify the records same data got retrieved by using Python and MySQL prompt thanks for watching
Info
Channel: E2E-IT-Tech
Views: 945
Rating: undefined out of 5
Keywords: #python, #python_mysql, #connect_mysql_database_with_python, #python_mysql_connector, #mysql_in_python
Id: hgzTp4ok1MQ
Channel Id: undefined
Length: 4min 26sec (266 seconds)
Published: Tue Aug 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.