I'm trying to connect Python from a Mac to a MySql database that is running on a Raspberry Pi 4 with Ubuntu Server LTS 20.04 installed where both machines are on my LAN. Currently I have MySql Workbench on the Mac and am able to access the database via a Standard TCP/IP connection using SSH. No problem accessing the server via the Terminal over SSH or logging into the database in question.
I'm running Python 3.8.5 on the Mac and the latest version of MySQL Server on the Ubuntu Server installed on the RPi4.
The issue comes up when I write the connection code in a Python file, and attempt to run it via the Terminal. Here is the error I am getting (spaces are mine):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 216, in _open_connection
self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Access denied for user '***'@'localhost' (using password: YES)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "testdb1PYTHON.py", line 3, in <module>
mydb = mysql.connector.connect(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mysql/connector/__init__.py", line 264, in connect
return CMySQLConnection(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 80, in __init__
self.connect(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mysql/connector/abstracts.py", line 966, in connect
self._open_connection()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 218, in _open_connection
raise errors.get_mysql_exception(msg=exc.msg, errno=exc.errno,
mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user```