issue mysql command through python

Solutions on MaxInterview for issue mysql command through python by the best coders in the world

showing results for - "issue mysql command through python"
Younes
10 Nov 2019
1import mysql.connector as mysql
2
3db = mysql.connect(
4    host = "localhost",
5    user = "root",
6    passwd = "dbms",
7    database = "datacamp"
8)
9
10cursor = db.cursor()
11
12## defining the Query
13query = "SELECT * FROM users"
14
15## getting records from the table
16cursor.execute(query)
17
18## fetching all records from the 'cursor' object
19records = cursor.fetchall()
20
21## Showing the data
22for record in records:
23    print(record)
24
similar questions
queries leading to this page
issue mysql command through python