'Python SQL Integration Error: mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I'm learning Python MySQL Connector basics from school, and one of the basics they asked us is to run the files they gave. However, no matter how many times I tried, it never worked. I would really appreciate if someone can help me with that.

Here are some of the things shown in the terminal:

import done - establishing connection Traceback (most recent call last): File "c:\Users\Database-Python Integration\db.py", line 3, in conn = mysql.connector.connect(user=connect.dbuser, \ File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector_init_.py", line 273, in connect
return MySQLConnection(*args, **kwargs) File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector\connection.py", line 115, in init
self.connect(**kwargs) File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector\abstracts.py", line 1028, in connect
self._open_connection() File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector\connection.py", line 494, in _open_connection self._do_auth(self._user, self._password, File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector\connection.py", line 236, in _do_auth
self._auth_switch_request(username, password) File "C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector\connection.py", line 282, in _auth_switch_request raise errors.get_exception(packet) mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) PS C:\Users\Database-Python Integration>



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source