MySQL-Utilities 工具报 TypeError: wrap_socket() got an unexpected keyword argument 'ciphers'

MySQL About 2,055 words

工具版本

Python版本:2.6.6

mysql-connector-python版本:2.1.7

错误信息

[root@root ~]# mysqldiskusage --server=root:12345678@192.168.153.100
WARNING: Using a password on the command line interface can be insecure.
# Source on 192.168.153.100: ... 
Traceback (most recent call last):
  File "/usr/bin/mysqldiskusage", line 126, in <module>
    servers = connect_servers(source_values, None)
  File "/usr/lib/python2.6/site-packages/mysql/utilities/common/server.py", line 489, in connect_servers
    source = get_server(src_name, src_dict, quiet, verbose=verbose)
  File "/usr/lib/python2.6/site-packages/mysql/utilities/common/server.py", line 336, in get_server
    server_conn.connect()
  File "/usr/lib/python2.6/site-packages/mysql/utilities/common/server.py", line 1098, in connect
    self.db_conn = self.get_connection()
  File "/usr/lib/python2.6/site-packages/mysql/utilities/common/server.py", line 1178, in get_connection
    db_conn = mysql.connector.connect(**parameters)
  File "/usr/lib/python2.6/site-packages/mysql/connector/__init__.py", line 179, in connect
    return MySQLConnection(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mysql/connector/connection.py", line 95, in __init__
    self.connect(**kwargs)
  File "/usr/lib/python2.6/site-packages/mysql/connector/abstracts.py", line 728, in connect
    self._open_connection()
  File "/usr/lib/python2.6/site-packages/mysql/connector/connection.py", line 228, in _open_connection
    self._ssl)
  File "/usr/lib/python2.6/site-packages/mysql/connector/connection.py", line 150, in _do_auth
    ssl_options.get('cipher'))
  File "/usr/lib/python2.6/site-packages/mysql/connector/network.py", line 420, in switch_to_ssl
    ssl_version=ssl.PROTOCOL_TLSv1, ciphers=cipher)
TypeError: wrap_socket() got an unexpected keyword argument 'ciphers'

错误原因

Python2.6.6中的ssl模板和mysql-connector-python2.1.7中的所需的方法签名不同。

解决办法

卸载2.1.7版本的mysql-connector-python,安装2.0.4版本。

参考

https://stackoverflow.com/questions/49052965/mysql-python-connector-typeerror-wrap-socket-got-an-unexpected-keyword-argume

Views: 4,272 · Posted: 2019-09-27

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh