MYSQL-Connector在建立数据库连接时在python中给出错误

时间:2019-12-26 10:50:32

标签: python mysql

我写的代码是:

'''

import mysql.connector as mysql

db = mysql.connect(
    host = "localhost",
    user = "root",
    passwd = "ankasaw"
)

print(db)

'''

我正在使用UBUNTU OS。我还安装了pip以及mysql DB和Connector pakage 我已经检查了mysql是否正确安装,但是它在那里并处于活动状态。

Error I am getting is :


    Traceback (most recent call last):
  File "Proj1.py", line 6, in <module>
    passwd = "ankasaw"
  File "/home/arrow/.local/lib/python3.7/site-packages/mysql/connector/__init__.py", line 179, in connect
    return MySQLConnection(*args, **kwargs)
  File "/home/arrow/.local/lib/python3.7/site-packages/mysql/connector/connection.py", line 95, in __init__
    self.connect(**kwargs)
  File "/home/arrow/.local/lib/python3.7/site-packages/mysql/connector/abstracts.py", line 716, in connect
    self._open_connection()
  File "/home/arrow/.local/lib/python3.7/site-packages/mysql/connector/connection.py", line 210, in _open_connection
    self._ssl)
  File "/home/arrow/.local/lib/python3.7/site-packages/mysql/connector/connection.py", line 142, in _do_auth
    auth_plugin=self._auth_plugin)
  File "/home/arrow/.local/lib/python3.7/site-packages/mysql/connector/protocol.py", line 102, in make_auth
    auth_data, ssl_enabled)
  File "/home/arrow/.local/lib/python3.7/site-packages/mysql/connector/protocol.py", line 58, in _auth_response
    auth = get_auth_plugin(auth_plugin)(
  File "/home/arrow/.local/lib/python3.7/site-packages/mysql/connector/authentication.py", line 191, in get_auth_plugin
    "Authentication plugin '{0}' is not supported".format(plugin_name))
mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported

0 个答案:

没有答案