pymysql.err.OperationalError:1045,“用户'admin'@'xx.153.63.4'的访问被拒绝使用密码:是”

问题描述

我是MysqL的新手。我还检查了与此无法解决的其他问题。

这是我的命令:

C:\Users\username\temp\Excercise\RDSQuery>python handler.py

这是我得到的结果:

Traceback (most recent call last):
  File "handler.py",line 20,in <module>
    connection = pyMysqL.connect(endpoint,user=username,File "C:\Users\username\temp\Excercise\RDSQuery\pyMysqL\__init__.py",line 94,in Connect
    return Connection(*args,**kwargs)
  File "C:\Users\username\temp\Excercise\RDSQuery\pyMysqL\connections.py",line 327,in __init__
    self.connect()
  File "C:\Users\username\temp\Excercise\RDSQuery\pyMysqL\connections.py",line 588,in connect
    self._request_authentication()
  File "C:\Users\username\temp\Excercise\RDSQuery\pyMysqL\connections.py",line 853,in _request_authentication
    auth_packet = self._read_packet()
  File "C:\Users\username\temp\Excercise\RDSQuery\pyMysqL\connections.py",line 676,in _read_packet
    packet.raise_for_error()
  File "C:\Users\username\temp\Excercise\RDSQuery\pyMysqL\protocol.py",line 223,in raise_for_error
    err.raise_MysqL_exception(self._data)
  File "C:C:\Users\username\temp\Excercise\RDSQuery\pyMysqL\err.py",line 107,in raise_MysqL_exception
    raise errorclass(errno,errval)
pyMysqL.err.OperationalError: (1045,"Access denied for user 'admin'@'xx.153.63.4' (using password: YES)")

这是我的python代码

import pyMysqL
endpoint = 'myauroradb-instance-1.xxxxxxxxx.eu-central-1.rds.amazonaws.com'
username = 'admin'
password = '123456'
database_name = 'Transactions_Prod'

#Connection
connection = pyMysqL.connect(endpoint,passwd=password,db=database_name)

def handler():
    cursor = connection.cursor()
    cursor.execute('SELECT * from Transactions')

    rows = cursor.fetchall()

    for row in rows:
        print("{0} {1} {2}".format(row[0],row[1],row[2]))
        
handler()

我在MysqL Workbrench中尝试了以下解决方案:

CREATE USER 'admin'@'xx.153.63.4' IDENTIFIED BY '123456';
drop user 'admin'@'xx.153.63.4';
flush privileges;
create user 'admin'@'xx.153.63.4' identified by '123456';
GRANT all privileges on Transactions_Prod.* to 'admin'@'xx.153.63.4' IDENTIFIED BY '123456' WITH GRANT OPTION;
SHOW GRANTS FOR 'admin'@'xx.153.63.4';

但是当我在cmd中运行文件时,我仍然遇到相同的错误

SHOW GRANTS FOR 'admin'@'xx.153.63.4';之后,我看到了:

'GRANT USAGE ON *.* TO \'admin\'@\'xx.153.63.4\' IDENTIFIED BY PASSWORD'

我知道这个平台已经提出了很多要求,但是我无法自行解决,请帮助我。

非常感谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...