출처: https://bumcrush.tistory.com/182 [맑음때때로 여름]

 

 

없으면 cmd에서 pip install pymysql 해준다.

포트는 기본 3306

import pymysql
project_db = pymysql.connect(host='127.0.0.1', db='open', user='aia', password='aia')

cursor1=project_db.cursor()

sql_select = 'select * from member'
cursor1.execute(sql_select)

while True :

    row = cursor1.fetchone()

    if row==None :
        break;
    print(row)

project_db.close()

 

+ Recent posts