1connectivity With Mysql in Python
1connectivity With Mysql in Python
#############
###################################################################################
###########
import mysql.connector
myConnection=""
cursor=""
userName=input("ENTER MYSQL SERVER'S USERNAME :")
password=input("ENTER MYSQL SERVER'S PASSWORD :")
code="utf8"
global myConnection
global userName
global password
myConnection=mysql.connector.connect(host="localhost",user=userName
,passwd=password ,charset='utf8')
if myConnection:
print(" CONGRATULATIONS ! YOUR MYSQL CONNECTION HAS BEEN ESTABLISHED ! ")
cursor=myConnection.cursor()
global userName
global password
global myConnection
global cid
global pcode
myConnection=mysql.connector.connect(host="localhost",user=userName,passwd=password
, database="telephone_billing" , auth_plugin='mysql_native_password',charset=code )
if myConnection:
return myConnection
else:
print("ERROR ESTABLISHING MYSQL CONNECTION ! ")
myConnection.close()
myConnection = MY_SQL_connection_check()
if myConnection:
MYSQLconnection ()
while(True):
print("""
1 >FOR NEW ITEM
'''
choice = int(input("Please Enter Your Choice : "))
if choice == 1:
addItem()
'''