Good day I am struggling to connect to MySQL with the mysql.connector method I am new to this and some guidance would be appreciated.
File "/usr/local/lib/python3.10/site-packages/mysql/connector/connection_cext.py", line 246, in _open_connection
self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Access denied for user 'QuantumCoder'@'10.0.4.243' (using password: YES)
**NO MATCH**
.
class config:
database_config = {
'host': 'QuantumCoder.mysql.pythonanywhere-services.com',
'user': 'QuantumCoder',
'password': '####',
'database': 'QuantumCoder$default'
}
def get_db():
try:
connection = mysql.connector.connect(**config.database_config)
print("Connected to MySQL database")
return connection
except mysql.connector.Error as err:
print(f"Error connecting to MySQL database: {err}")
return None