python import asyncio import aiomysql async def query_example(): pool = await aiomysql.create_pool(host='localhost', port=3306, user='root', password='password', db='mydb') async with pool.acquire() as conn: async with conn.cursor() as cur: await cur.execute("SELECT * FROM mytable") result = await cur.fetchall() print(result) pool.close() await pool.wait_closed() asyncio.run(query_example())


上一篇:
下一篇:
切换中文