0

I am having issues connecting to a remote SQL server.

dbconfig = {
 'user': 'dbuser',
 'password': 'password',
 'host': '123.45.6.789',
 'database': 'dbname',

}

def import_prices():
 cnx = mysql.connector.connect(**dbconfig)
 cur = cnx.cursor() 

The error I am getting is:

mysql.connector.errors.ProgrammingError: 1045 (28000): 
Access denied for user dbuser'@'12-34-45-555-dynamic.agg1.roc.bbh-prp.eircom.net' 
(using password: YES)

I don't know why it is adding my hostname (from internet connection) to the user. The database was set up in cPanel and when I connect from it from within the server I just use localhost.

asked Nov 13, 2015 at 0:35

2 Answers 2

1

Likely this is not a Python or remote issue, but rather that you need to configure the mySQL server to accept connections for dbuser from either all hosts your specific host (IP).

answered Nov 13, 2015 at 0:38
Sign up to request clarification or add additional context in comments.

Comments

0

To expand on Colin, you probably need to do something like below:

CREATE USER 'dbuser'@'123.45.6.789' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON dbname.* TO 'dbuser'@'123.45.6.789';

answered Nov 13, 2015 at 2:30

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.