mysql_db.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:core-python 作者: yidao620c 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号