MyCATApache / Mycat-Server

GNU General Public License v2.0
9.51k stars 3.85k forks source link

python3 mysql-connector-python包linux环境下无法连接mycat报密码错误 #2737

Closed kimiliang123 closed 3 years ago

kimiliang123 commented 3 years ago

python版本3.6.5 mysql-connector-python 8.0.12 mycat版本1.6.5 比较奇怪的是,在windows环境下可以连,但是同样版本的python和mysql-connector-python在centos7.X上面都不行

报错如下 `import mysql.connector as mysql connection = mysql.connect(host="10.251.xx.xx", port=xxxx, db="test", user="u_test", passwd="xxxxx") Traceback (most recent call last): File "/usr/local/virtualenv/py_ptolemy/lib/python3.6/site-packages/mysql/connector/connection_cext.py", line 176, in _open_connection self._cmysql.connect(**cnx_kwargs) _mysql_connector.MySQLInterfaceError: Access denied for user 'u_test', because password is error

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/usr/local/virtualenv/py_ptolemy/lib/python3.6/site-packages/mysql/connector/init.py", line 172, in connect return CMySQLConnection(*args, kwargs) File "/usr/local/virtualenv/py_ptolemy/lib/python3.6/site-packages/mysql/connector/connection_cext.py", line 78, in init self.connect(kwargs) File "/usr/local/virtualenv/py_ptolemy/lib/python3.6/site-packages/mysql/connector/abstracts.py", line 731, in connect self._open_connection() File "/usr/local/virtualenv/py_ptolemy/lib/python3.6/site-packages/mysql/connector/connection_cext.py", line 179, in _open_connection sqlstate=exc.sqlstate) mysql.connector.errors.DatabaseError: 1045 (HY000): Access denied for user 'u_test', because password is error `

funnyAnt commented 3 years ago

@kimiliang123 密码中是否有特殊字段, 全部改成字母试试效果。

具体原因可以调试下FrontendAuthenticator.checkPassword()这个函数的代码。

junwen12221 commented 3 years ago

mycat设置忽略密码 或者客户端降级到5.7的客户端