add a try/except and assert for mysql connection fail problem