tortoise / tortoise/tortoise-orm
Connect MySQL (version 8.0.25)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
Traceback (most recent call last):
File "c:\software\program\python\python38\lib\site-packages\aiomysql\connection.py", line 503, in _connect
await self._request_authentication()
File "c:\software\program\python\python38\lib\site-packages\aiomysql\connection.py", line 796, in _request_authentication
await self._process_auth(plugin_name, auth_packet)
File "c:\software\program\python\python38\lib\site-packages\aiomysql\connection.py", line 848, in _process_auth
pkt = await self._read_packet()
File "c:\software\program\python\python38\lib\site-packages\aiomysql\connection.py", line 593, in _read_packet
packet.check_error()
File "c:\software\program\python\python38\lib\site-packages\pymysql\protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "c:\software\program\python\python38\lib\site-packages\pymysql\err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'...' (using password: YES)")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\software\program\python\python38\lib\site-packages\tortoise\backends\mysql\client.py", line 115, in create_connection
self._pool = await mysql.create_pool(password=self.password, **self._template)
File "c:\software\program\python\python38\lib\site-packages\aiomysql\pool.py", line 29, in _create_pool
await pool._fill_free_pool(False)
File "c:\software\program\python\python38\lib\site-packages\aiomysql\pool.py", line 167, in _fill_free_pool
conn = await connect(echo=self._echo, loop=self._loop,
File "c:\software\program\python\python38\lib\site-packages\aiomysql\connection.py", line 75, in _connect
await conn._connect()
File "c:\software\program\python\python38\lib\site-packages\aiomysql\connection.py", line 521, in _connect
raise OperationalError(2003,
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '...'")
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\software\program\python\python38\lib\runpy.py", line 194, in _run_module_as_main
return run_code(code, main_globals, None,
File "c:\software\program\python\python38\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\SoftWare\Program\Python\Python38\Scripts\aerich.exe_main.py", line 7, in
File "c:\software\program\python\python38\lib\site-packages\aerich\cli.py", line 317, in main
cli()
File "c:\software\program\python\python38\lib\site-packages\click\core.py", line 764, in call
return self.main(*args, **kwargs)
File "c:\software\program\python\python38\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\software\program\python\python38\lib\site-packages\click\core.py", line 1134, in invoke
Command.invoke(self, ctx)
File "c:\software\program\python\python38\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\software\program\python\python38\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\software\program\python\python38\lib\site-packages\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\software\program\python\python38\lib\site-packages\aerich\cli.py", line 41, in wrapper
loop.run_until_complete(f(*args, **kwargs))
File "c:\software\program\python\python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "c:\software\program\python\python38\lib\site-packages\aerich\cli.py", line 91, in cli
await Migrate.init(tortoise_config, app, location)
File "c:\software\program\python\python38\lib\site-packages\aerich\migrate.py", line 66, in init
await Tortoise.init(config=config)
File "c:\software\program\python\python38\lib\site-packages\tortoise_init.py", line 598, in init
await cls._init_connections(connections_config, create_db)
File "c:\software\program\python\python38\lib\site-packages\tortoise_init.py", line 390, in _init_connections
await connection.create_connection(with_db=True)
File "c:\software\program\python\python38\lib\site-packages\tortoise\backends\mysql\client.py", line 135, in create_connection
raise DBConnectionError(f"Can't connect to MySQL server: {self._template}")
tortoise.exceptions.DBConnectionError: Can't connect to MySQL server: {'host': '...', 'port': 3306, 'user': 'root', 'db': 'recharge', 'autocomm
it': True, 'charset': 'utf8mb4', 'minsize': 1, 'maxsize': 5, 'sql_mode': 'STRICT_TRANS_TABLES'}
But used Mysql (5.7) was successful to connect.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the MySQL backend path in tortoise/backends/mysql/client.py with the traceback from aiomysql/connection.py, using the reported MySQL 8.0.25 setup and the successful 5.7 setup as the reproduction. Check the Aerich initialization path, then verify that a MySQL 8 connection succeeds without the reported DBConnectionError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, python
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100