Paul Chris Jones's coding blog
PHP
JS

1045 (28000): Access denied

9th November 2020

I have a Python script that connects to a MySQL database. Recently though it stopped working and gave this error instead:

1045 (28000): Access denied for user 'paulchrisjones'@'96.144.59.87' (using password: YES)

Here's my python code:

host ='179.167.106.108'
database = 'mydatabase'
user = 'paulchrisjones'
password = 'Hunter2'

conn = None

try:
        conn = mysql.connector.connect(
                host = host,
                database = database,
                user = user,
                password = password
        )

        if conn.is_connected():
        [...]

Then I found this on Stackoverflow:

You have to enable access for the IP address of the computer you are trying to access the server from. By default the database server doesn't allow outside connections. You'll do this by logging into your host (Bluehost)

Log into cPanel and click the Remote MySQL icon, under Databases.

Type in the connecting IP address, and click the Add Host button.

Click Add, and you should now be able to connect remotely to your database.

And that worked. I just had to add my IP to that list.

The IP was right there in the error message all along:

1045 (28000): Access denied for user 'paulchrisjones'@'96.144.59.87' (using password: YES)

Probably this problem started because I switched internet providers recently. Actually, that would explain it.

Leave a comment