Forums

Error 1044 (Access Denied).

I'm the following error each time I try to connect to the DB via script:

mysql.connector.errors.ProgrammingError: 1044 (42000): Access denied for user 'Kbungo'@'%' to database 'Gaslight'

The following code is my connection code:

db = mysql.connector.connect(user='Kbungo', password='<passwordHere>, host='mysql.server', database='Kbungo$OngoingGaslights')

I am not running a webserver (I previously ran flask, but did not need it any longer), although I do have a database of the proper name. If I enter MYSQL via the BASH shell, I am able to access my database and edit it with no issue. I'm certain the MYSQL commands are correct (I attempted them manually).

Do I have to run a Django webpage? What am I missing?

You should be find connecting to the DB from a script, we definitely don't limit you to Django.

One thing that's a bit odd about the error there is that it says it's trying to connect to the database Gaslight rather than Kbungo$OngoingGaslights. Are you sure you're running the right script? Or that there isn't some other DB connection code in your script that's trying to connect to the wrong database?

Uhhhm using the EXACT same code as last night, it seems that my code is running smoothly now?

I'm not lying to protect some sort of 'programming dignity'. If I were wrong, I would admit it since I know you guys need to know if it legitimately is an issue...

It works fine now (Well my code is still jacked, but this part is my fault).

Thanks so much for your help anyways! Keep being awesome staff. You guys are the best!

Um, glad to help, I guess :-S

Hey, one possibility -- sometimes code changes can take a second or so to sync from server to server on our systems. Is it at all possible that you were editing it in our in-browser editor, changed the database name in the connector.connect line, hit control-S or the save button, and then really really quickly switched tabs to a console and ran it (perhaps with an up-arrow-return)? As I say, you'd have to do the save-switch-run thing in less than a second, but it's the only possibility I can think of.

this went on for about 5 hours that night. so even if that was the case, It'd be more impressive than anything haha!

Maybe it takes a bit for the database to populate it's permissions and accounts and the like and accessing it wasn't ready to be from another program? I did set it up and start trying to access via the program immediately..

Hmm, it should take new permissions immediately, there's no sync lag. And that doesn't explain the fact that the DB name is wrong in the error message. Very peculiar!