def _connect():
config = {
'user': 'root',
'password': 'mysql',
'host': '192.168.200.33',
'database': 'fastloan3',
'raise_on_warnings': True,
}
cnx = None
try:
cnx = mysql.connector.connect(**config)
except mysql.connector.Error as err:
if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or password")
elif err.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(err)
if cnx:
cnx.close()
return cnx
评论列表
文章目录