Python Refusing to Connect to MySQL

This is used for general discussion that is not necessarily server-related.
Post Reply
XDE4TH
A regular
A regular
Posts: 55
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Mon Oct 28, 2013 11:02 pm

Python Refusing to Connect to MySQL

Post by XDE4TH »

So I'm working on a Python script that will run from my VPS that I need to connect to a database on my webhosting, all with NFO.

I currently have a few various applications connecting to databases just fine in PHP. However when I try to connect to these databases in Python I keep getting refused. I've tried the MySQL Connector module and MySQLdb module. Both throw the same error.

_mysql_exceptions.OperationalError: (1044, "Access denied for user 'username'@'%' to database 'database_name'")
mysql.connector.errors.ProgrammingError: 1044 (42000): Access denied for user 'username'@'%' to database 'database_name'

These same credentials are working elsewhere and for other applications, I don't understand why it isn't for Python. Any suggestions or thoughts? Anyone else ever had a similar problem?
XDE4TH
A regular
A regular
Posts: 55
Joined: Mon Oct 28, 2013 11:02 pm

Re: Python Refusing to Connect to MySQL

Post by XDE4TH »

Maybe it is just my local machine or something but it appears that it will connect okay when running the script on the VPS. I managed to get it to tell me the server version. I'll continue testing on this and see what happens.
User avatar
soja
This is my homepage
This is my homepage
Posts: 2389
Joined: Fri May 18, 2012 3:20 pm

Re: Python Refusing to Connect to MySQL

Post by soja »

XDE4TH wrote:Maybe it is just my local machine or something but it appears that it will connect okay when running the script on the VPS. I managed to get it to tell me the server version. I'll continue testing on this and see what happens.
Have you made sure the "allow external connections" box is checked on the databse your python script is using?
Not a NFO employee
Post Reply