Skip to content

Instantly share code, notes, and snippets.

@vijayakumarchinthala
Last active January 27, 2021 07:36
Show Gist options
  • Select an option

  • Save vijayakumarchinthala/f887bb63e7bd05fbc57f564e4c1909c2 to your computer and use it in GitHub Desktop.

Select an option

Save vijayakumarchinthala/f887bb63e7bd05fbc57f564e4c1909c2 to your computer and use it in GitHub Desktop.
mysql with python
import mysql.connector as sqltor
mycon=sqltor.connect(host="localhost",user="root",passwd="tiger",database="gvkcv")
if mycon.is_connected()==False:
print("error connecting to database")
cursor=mycon.cursor()
cursor.execute("select *from student10")
data=cursor.fetchall()
for i in data:
print(i)
mycon.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment