Reputation: 49
I cannot seem to figure out why I'm getting this error. Any ideas?
I have double-checked the username and password. I'm using A2 Hosting to host my MySQL database.
(.venv) lukebouch@MacBook-Pro-2 20200815-BiblicalResponses % "/Users/lukebouch/GoogleDrive/My Drive/Development/Projects/20200815-BiblicalResponses/.venv/bin/python" "/Users/lukebouch/GoogleDrive/My Drive/Development/Projects/20200815-BiblicalResponses/util/database.py"
Traceback (most recent call last):
File "/Users/lukebouch/GoogleDrive/My Drive/Development/Projects/20200815-BiblicalResponses/util/database.py", line 3, in <module>
db = mysql.connector.connect(
File "/Users/lukebouch/GoogleDrive/My Drive/Development/Projects/20200815-BiblicalResponses/.venv/lib/python3.8/site-packages/mysql/connector/__init__.py", line 179, in connect
return MySQLConnection(*args, **kwargs)
File "/Users/lukebouch/GoogleDrive/My Drive/Development/Projects/20200815-BiblicalResponses/.venv/lib/python3.8/site-packages/mysql/connector/connection.py", line 95, in __init__
self.connect(**kwargs)
File "/Users/lukebouch/GoogleDrive/My Drive/Development/Projects/20200815-BiblicalResponses/.venv/lib/python3.8/site-packages/mysql/connector/abstracts.py", line 716, in connect
self._open_connection()
File "/Users/lukebouch/GoogleDrive/My Drive/Development/Projects/20200815-BiblicalResponses/.venv/lib/python3.8/site-packages/mysql/connector/connection.py", line 208, in _open_connection
self._do_auth(self._user, self._password,
File "/Users/lukebouch/GoogleDrive/My Drive/Development/Projects/20200815-BiblicalResponses/.venv/lib/python3.8/site-packages/mysql/connector/connection.py", line 144, in _do_auth
self._auth_switch_request(username, password)
File "/Users/lukebouch/GoogleDrive/My Drive/Development/Projects/20200815-BiblicalResponses/.venv/lib/python3.8/site-packages/mysql/connector/connection.py", line 177, in _auth_switch_request
raise errors.get_exception(packet)
mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'lukesmed_biblical'@'c-73-31-227-71.hsd1.va.comcast.net' (using password: YES)
Here is my code. Obviously, I have excluded the username and password.
import mysql.connector
db = mysql.connector.connect(
host="",
user="",
password="",
database="",
)
print(db)
Upvotes: 0
Views: 286
Reputation: 442
The password
parameter should be spelled out correctly (password
not passwd
).
You are also missing a couple of parameters.
Here is the correct syntax:
db = mysql.connector.connect(
host="",
user="",
password="",
database="",
)
Upvotes: 2