List of steps to reproduce (step by step, including full links if applicable):
- Log into Toolforge and become your tool account
- Create a python virtual environment using your tool account: python3 -m venv venv
- Activate the venv: . ~/venv/bin/activate
- Install the mysqlclient package for python: pip install mysqlclient
- Try connecting to a Cloud-Services Wikireplica database:
import MySQLdb MySQLdb.connect( "fawiki.web.db.svc.wikimedia.cloud", db="fawiki_p", read_default_file="~/replica.my.cnf")
What happens?:
An error message is shown:
MySQLdb._exceptions.OperationalError: (1045, "Access denied for user 'tools.huji'@'10.64.37.28' (using password: NO)")
What should have happened instead?:
You should be able to connect to the database
Other useful information:
I can connect to the Wikireplica DBs from the command line myself, e.g. using sql fawiki_p. This means the config file at ~/replica.my.cnf contains correct information. I can also verify that after connecting to the DB, running SELECT CURRENT_USER returns the same user ID as found in the replica.my.cnf file.
Maybe the issue is that this file is not properly read or used by the Python MYSQLdb package? But it used to work until Stretch upgrade.