I am trying to retrieve some data from database, but when I run https://api.opendental.com/api/v1/queries/ShortQuery (PUT), I get an error that "An SQL error occured: Authentication to host 'localhost' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'localhost' to database 'demo'"
The body of the api is:
{
"SqlCommand": "SELECT LName FROM provider WHERE ProvNum = 1"
}
this is a simple query that I use to test whether I can run query using the ShortQuery api or not. Any help would be appreciated.
thanks
ShortQuery
Re: ShortQuery
The ShortQuery method will use the ''@localhost MySql user for your database by default, unless you have specifically set up a different UserLow (which is rare). This ''@localhost user has no permissions granted by default, so you just need to grant that MySql user SELECT privileges to be able to run your query.
-
- Posts: 2
- Joined: Mon Jul 26, 2021 6:28 pm
Re: ShortQuery
thank you SLeon, it works.
- jordansparks
- Site Admin
- Posts: 5755
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
Re: ShortQuery
Hmm. This doesn't seem right. Didn't we change that to use the normal MySQL user? I'm on vacation for a week, but I didn't want to forget to circle back around to this. In other words, the ShortQuery should work out of the box without any additional setup.
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com
Re: ShortQuery
We did have to grant @localhost read access as well to get the API to work for ShortQuery. Is this something that you think is being changed JordanSparks? We need to include it in our evaluation of which integration options to use with Open Dental if we need to set this configuration on all of the our client's machines.
- jordansparks
- Site Admin
- Posts: 5755
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
Re: ShortQuery
I think it's already fixed, but if not, I would consider it a bug and we will fix it. No changes to MySQL users should be required.
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com