mysql.connector Access denied

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/", line 246, in _open_connection
_mysql_connector.MySQLInterfaceError: Access denied for user 'QuantumCoder'@'' (using password: YES)


class config:
    database_config = {
        'host': '',
        'user': 'QuantumCoder',
        'password': '####',
        'database': 'QuantumCoder$default'

def get_db():
        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

Make sure you use the right password set for your MySQL databases.

I did make sure I used the correct password and still no luck.

MySQL has issues with some special characters in password so, if you have special characters in your password, try changing to one without those.