Solved

SELECT command denied to user 'web215-crm'@'10.0.29.64' for table 'parentinventory'

Posted on 2014-09-14
8
50 Views
Last Modified: 2015-09-19
Hi,

I am getting the following error with a SELECT statement on a shared hosting server.

SELECT command denied to user 'web215-crm'@'10.0.29.64' for table 'parentinventory'

It was working but not sure what has changed to affect it now or if it is on the hosting server end.
0
Comment
Question by:thinklings
  • 6
  • 2
8 Comments
 
LVL 24

Expert Comment

by:mankowitz
ID: 40321982
I don't know how much of the database you really have access to. MySQL provides table and command level access prohibitions. Can you get to a MySQL console? If so, you are ultimately going to want to issue a command like this

GRANT SELECT  ON `parentinventory` to `web215-crm`@`10.0.29.64`

However, I suspect you won't have the GRANT privilege, and you will probably have to talk to your hosting company about that.
0
 

Author Comment

by:thinklings
ID: 40321988
Thanks, I have contacted my hosting provider to see if there is anything they can sort out on their end.
0
 

Author Comment

by:thinklings
ID: 40322265
I got the following response from my hosting provider -

Thank you for your patience, we had a closer look at this. The issue isn't to do with permissions, currently database web215-crm has the following permissions:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `web215-crm`.* TO 'web215-crm'@'%' WITH GRANT OPTION

Select is in there as you can see, it could in relation to a script issue. It could to do with authentication is handled in your code when query is run for the user?
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:thinklings
ID: 40322266
How do I check if authentication is handled within my code?
0
 

Author Comment

by:thinklings
ID: 40322267
This is an example of a query that I am running -

SQLString = "SELECT idCompanies FROM `web215-crm`.Companies WHERE trim(CompanyName) = '" & Trim(ASPxComboBoxCompany.Text) & "'"

Open in new window


And this is the connection string I am using -

<connectionStrings>
    <add name="CJG" connectionString="User Id=web215-crm;server=79.170.44.215;Persist Security Info=True;database=web215-crm;pwd=XXXXXXX;convert zero datetime=True" providerName="MySql.Data.MySqlClient" />
  </connectionStrings>

Open in new window

0
 
LVL 24

Expert Comment

by:mankowitz
ID: 40322815
Sometimes, you can get that error if you reference a table that doesn't exist or if you inadvertently connect to the wrong server. Can you confirm that
1. The server is 79.170.44.215
2. There is a table "Companies" in schema web215-crm

try replacing your select statement with something very basic to see if it works.

SQLString = "SELECT idCompanies FROM `web215-crm`.Companies WHERE 1"

Also, as a note for later, be very careful of including user input in an SQL query. You should either escape ASPxComboBoxCompany.Text or use a parameterized query.
0
 

Accepted Solution

by:
thinklings earned 0 total points
ID: 40322897
Thanks mankowitz.. All references were correct so I just rebuilt the software with the same code and all is working now. Not sure what the problem was or what was fixed but it is operating now.

Thanks again for your help.
0
 

Author Closing Comment

by:thinklings
ID: 40984552
No proper solution here. Just worked after a rebuild.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Creating and Managing Databases with phpMyAdmin in cPanel.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question