Showing Data in MySql Database in Console - The Advantages of Learning Python Programming for Beginners: A Comprehensive Guide

Latest

Dive into the world of Python programming with our comprehensive resources

Music

logo

Monday, May 15, 2023

Showing Data in MySql Database in Console

 

In this article, I am connecting to MySql database. 

I'm printing the data in the table to the console screen.

 


 

 

 

 

 

 

 

import mysql.connector

 

conn = mysql.connector.connect(

    host="localhost",

    database="book",

    user="root",

    password="1234" )

 

cursor = conn.cursor()

cursor.execute("Select * From worldclassics")

 

for row in cursor:

    print(row)

 

 

Hope to see you in the next article. Happy coding.

No comments:

Post a Comment

Featured post

Python Introduction

What is Python? Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built ...