pip install aiomysql python import asyncio import aiomysql python async def main(): conn = await aiomysql.connect(host='localhost', port=3306, user='root', password='password', db='test') cur = await conn.cursor() await cur.execute("SELECT * FROM users") result = await cur.fetchall() cur.close() conn.close() await conn.wait_closed() print(result) asyncio.get_event_loop().run_until_complete(main())


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