Page MenuHomePhabricator

mlWikidbupdate using improper credentials to connect to databases
Closed, ResolvedPublic

Description

I have created a tool named mlWikidbupdate. When running the command

python editcount.py

following error was generated:

  File "editcount.py", line 88, in <module>
    conn = pymysql.connect(host=settings.host,db=settings.dbname,read_default_file='~/.my.cnf',charset='utf8mb4',)
  File "/mnt/nfs/labstore-secondary-tools-project/mlwikidbupdate/venv/local/lib/python2.7/site-packages/pymysql/__init__.py", line 94, in Connect
    return Connection(*args, **kwargs)
  File "/mnt/nfs/labstore-secondary-tools-project/mlwikidbupdate/venv/local/lib/python2.7/site-packages/pymysql/connections.py", line 325, in __init__
    self.connect()
  File "/mnt/nfs/labstore-secondary-tools-project/mlwikidbupdate/venv/local/lib/python2.7/site-packages/pymysql/connections.py", line 599, in connect
    self._request_authentication()
  File "/mnt/nfs/labstore-secondary-tools-project/mlwikidbupdate/venv/local/lib/python2.7/site-packages/pymysql/connections.py", line 861, in _request_authentication
    auth_packet = self._read_packet()
  File "/mnt/nfs/labstore-secondary-tools-project/mlwikidbupdate/venv/local/lib/python2.7/site-packages/pymysql/connections.py", line 684, in _read_packet
    packet.check_error()
  File "/mnt/nfs/labstore-secondary-tools-project/mlwikidbupdate/venv/local/lib/python2.7/site-packages/pymysql/protocol.py", line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "/mnt/nfs/labstore-secondary-tools-project/mlwikidbupdate/venv/local/lib/python2.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, u"Access denied for user 'tools.mlwikidbupdate'@'10.64.37.27' (using password: NO)")

Event Timeline

Aklapper changed the task status from Open to Stalled.May 31 2020, 5:28 PM

Hi, we don't know what the tool does or where its code is. Please read and follow https://www.mediawiki.org/wiki/How_to_report_a_bug when creating tickets.
Also, how is this related to wikitech.wikimedia.org?

I added it only due to the reason that it's related to tools

Majavah added a subscriber: Majavah.

You're using the wrong username when accessing MySQL, the correct username and password are available on a file named replica.my,cnf on your tool's home directory. See https://wikitech.wikimedia.org/wiki/Help:Toolforge/Database for more details.

bd808 added a subscriber: bd808.

Your trace shows this python code:
conn = pymysql.connect(host=settings.host,db=settings.dbname,read_default_file='~/.my.cnf',charset='utf8mb4',)

Later this error is reported:
pymysql.err.OperationalError: (1045, u"Access denied for user 'tools.mlwikidbupdate'@'10.64.37.27' (using password: NO)")

It appears that you have manually created a $HOME/.my.cnf file and set incorrect credentials there. The tool's $HOME/replica.my.cnf file contains the proper credentials. Please read https://wikitech.wikimedia.org/wiki/Help:Toolforge/Database for more information.

bd808 renamed this task from Access denied issue when running a tool to mlWikidbupdate using improper credentials to connect to databases.May 31 2020, 6:31 PM
bd808 changed the task status from Stalled to Open.Jun 1 2020, 3:38 AM
bd808 assigned this task to Adithyak1997.

Thanks a lot. I replaced

conn = pymysql.connect(host=settings.host,db=settings.dbname,read_default_file='~/.my.cnf',charset='utf8mb4',)

with

conn = pymysql.connect(host=settings.host,db=settings.dbname,read_default_file='~/replica.my.cnf',charset='utf8mb4',)

and it started working.