<i id='6EQfy'><tr id='6EQfy'><dt id='6EQfy'><q id='6EQfy'><span id='6EQfy'><b id='6EQfy'><form id='6EQfy'><ins id='6EQfy'></ins><ul id='6EQfy'></ul><sub id='6EQfy'></sub></form><legend id='6EQfy'></legend><bdo id='6EQfy'><pre id='6EQfy'><center id='6EQfy'></center></pre></bdo></b><th id='6EQfy'></th></span></q></dt></tr></i><div id='6EQfy'><tfoot id='6EQfy'></tfoot><dl id='6EQfy'><fieldset id='6EQfy'></fieldset></dl></div>
    <bdo id='6EQfy'></bdo><ul id='6EQfy'></ul>
<legend id='6EQfy'><style id='6EQfy'><dir id='6EQfy'><q id='6EQfy'></q></dir></style></legend>

  1. <small id='6EQfy'></small><noframes id='6EQfy'>

  2. <tfoot id='6EQfy'></tfoot>

      为什么 mysql.connector 在 python2.7 和 python3 上没有问题?

      时间:2023-07-06

    1. <i id='eYzWV'><tr id='eYzWV'><dt id='eYzWV'><q id='eYzWV'><span id='eYzWV'><b id='eYzWV'><form id='eYzWV'><ins id='eYzWV'></ins><ul id='eYzWV'></ul><sub id='eYzWV'></sub></form><legend id='eYzWV'></legend><bdo id='eYzWV'><pre id='eYzWV'><center id='eYzWV'></center></pre></bdo></b><th id='eYzWV'></th></span></q></dt></tr></i><div id='eYzWV'><tfoot id='eYzWV'></tfoot><dl id='eYzWV'><fieldset id='eYzWV'></fieldset></dl></div>
        <bdo id='eYzWV'></bdo><ul id='eYzWV'></ul>

          <tbody id='eYzWV'></tbody>

        <small id='eYzWV'></small><noframes id='eYzWV'>

        <tfoot id='eYzWV'></tfoot>
        1. <legend id='eYzWV'><style id='eYzWV'><dir id='eYzWV'><q id='eYzWV'></q></dir></style></legend>

              • 本文介绍了为什么 mysql.connector 在 python2.7 和 python3 上没有问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我查看了不同的帖子,例如:有吗一种在 MariaDB 10.4.7 中使用 mysql-connector-python 中的pool_reset_connection"的方法?

                I checked different post like: Is there a way to use 'pool_reset_connection' from mysql-connector-python with MariaDB 10.4.7?

                但我无法解决我的问题,我有一个用 python 2.7 编写的程序;现在我将所有内容都移至 python 3,但 mysql.connector 出现问题.

                But I can't solve my isue, I have a program write in python 2.7; now I'm moving everything to python 3 but I got problems with mysql.connector.

                此时我正在使用 python 3.8.2 和 mysql-connector-python==8.0.19,但我尝试使用不同版本的 python 3,但是当我尝试时,我在 mysql.connector 上总是遇到相同的错误关闭连接.

                In this moment I'm using python 3.8.2 and mysql-connector-python==8.0.19 but I try with different version of python 3, but I was getting always the same error on mysql.connector when I try to close the connection.

                Traceback (most recent call last):
                  File "C:Python38libsite-packagesmysqlconnectorconnection.py", line 819, in reset_session
                    self.cmd_reset_connection()
                  File "C:Python38libsite-packagesmysqlconnectorconnection.py", line 1166, in cmd_reset_connection
                    raise errors.NotSupportedError("MySQL version 5.7.2 and "
                mysql.connector.errors.NotSupportedError: MySQL version 5.7.2 and earlier does not support COM_RESET_CONNECTION.
                
                ...
                ...
                
                mysql.connector.errors.OperationalError: 1047 (08S01): Unknown command
                

                我不知道如何解决它,我尝试以不同的方式增加池并拥有不同的池,或者只是关闭连接,但在我遇到池耗尽后的一个大项目中,所以我真的需要关闭连接,但我可以'不解决这个问题;有人可以帮我吗?

                I'm not sure how to solve it, I try in different way increasing the pool and having different pool or just shutdown the connection but in a big project after I got pool exhaust so I really need close the connection but I can't solve this issue; can someone help me pls?

                我什至尝试按照其他 stackoverflow 票证中的说明更改 mysql-connector 库,但每次更改时都会遇到其他问题.

                I try even to change the mysql-connector library as explained in the other stackoverflow ticket but every time I change it I got other problems.

                推荐答案

                MySQL Connector/Python如何检测服务器版本的问题:

                It's a problem how MySQL Connector/Python detects the server version:

                由于复制不适用于 2 位主版本号,MariaDB 使用了所谓的 RPL hack,它是在 10.0 版中引入的,并将以下版本号发送到客户端 5.5.5-10.4.13-MariaDB.另请参阅 MariaDB 的第一部分是什么版本字符串的意思.

                Since replication doesn't work with a 2-digit major version number, MariaDB uses a so called RPL hack which was introduced with version 10.0 and sends the following version number to the client 5.5.5-10.4.13-MariaDB. See also What does the first part of the MariaDB version string mean.

                由于 MariaDB 连接器/Python 不知道,它假定服务器版本号为 5.5.5,并在检查 >= 5.7.3 时会引发 NotSupportedError 异常.

                Since MariaDB Connector/Python is not aware of it, it assumes that the server version number is 5.5.5 and will raise a NotSupportedError exception when checking >= 5.7.3.

                您可以修补 MySQL Connector/Python(在 do_handshake() 中修复 server_version),也可以尝试 MariaDB Connector/Python.它目前处于测试阶段,但预计本月仍会 GA(pip3 install mariadb)

                You can either patch MySQL Connector/Python (fixing server_version in do_handshake()) or you can try MariaDB Connector/Python. It's currently beta, but GA is expected still this month (pip3 install mariadb)

                这篇关于为什么 mysql.connector 在 python2.7 和 python3 上没有问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:将 Python3 连接到 MariaDB 的困难 - 取 1 下一篇:SQL并发事务忽略彼此的锁???死锁 [InnoDB, Python]

                相关文章

                <small id='NWhnd'></small><noframes id='NWhnd'>

              • <legend id='NWhnd'><style id='NWhnd'><dir id='NWhnd'><q id='NWhnd'></q></dir></style></legend>
              • <i id='NWhnd'><tr id='NWhnd'><dt id='NWhnd'><q id='NWhnd'><span id='NWhnd'><b id='NWhnd'><form id='NWhnd'><ins id='NWhnd'></ins><ul id='NWhnd'></ul><sub id='NWhnd'></sub></form><legend id='NWhnd'></legend><bdo id='NWhnd'><pre id='NWhnd'><center id='NWhnd'></center></pre></bdo></b><th id='NWhnd'></th></span></q></dt></tr></i><div id='NWhnd'><tfoot id='NWhnd'></tfoot><dl id='NWhnd'><fieldset id='NWhnd'></fieldset></dl></div>
                  • <bdo id='NWhnd'></bdo><ul id='NWhnd'></ul>
                  <tfoot id='NWhnd'></tfoot>