问题描述
这是我的命令:
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()
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';
在SHOW GRANTS FOR 'admin'@'xx.153.63.4';
之后,我看到了:
'GRANT USAGE ON *.* TO \'admin\'@\'xx.153.63.4\' IDENTIFIED BY PASSWORD'
我知道这个平台已经提出了很多要求,但是我无法自行解决,请帮助我。
非常感谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)