MySql SELECT command denied to user (Despite having all privileges) - mysql

Really lost on this one. Apparently this error text can be a red herring. Hoping to get some other eyes on this. I'm doing this as a user with specified privileges. When I try the commands as root, everything works just fine, so I've narrowed it down to permissions or an issue w/ the user.
Basically, I'm calling DELETE on a row. Pretty simple stuff.
DELETE FROM hits WHERE id IN(12345) AND userId = 1
That results in this error:
{ [Error: ER_COLUMNACCESS_DENIED_ERROR: SELECT command denied to user 'auctions'#'myhost' for column 'id' in table 'hits']
Okay, weird... I know the user has privileges. The following query returns a set of rows.
SELECT * FROM hits
At first the user had SELECT,INSERT,UPDATE,DELETE. Now I've just done GRANT ALL PRIVILEGES (from any host) but I get the same results. Here's what SHOW GRANTS shows
GRANT ALL PRIVILEGES ON `database`.`hits` TO 'auctions'#'%'
Yet, I still get this same error. As per before, running as root everything works just fine.
This is a node script calling the queries, but I've confirmed the behavior through PhpMyAdmin as well, so I will assume that's not to blame.
My version is 5.6.19

Related

The user specified as a definer does not exist - GRANT doesn't fix

After years of no problems with my PHP webapp running MySQL 5.5 on the backend, suddenly today I'm having permissions problems.
Whenever I try to run an INSERT statement (either from PHP or from Workbench or Heidi), I get this error message: The user specified as a definer ('my_user'#'1.2.3.%') does not exist
One symptom is that INSERT statements cannot be executed by my PHP nor by remote clients such as Workbench or Heidi. I have tried various solutions suggested by:
MySQL error 1449: The user specified as a definer does not exist
Error: 1449, "The user specified as a definer ('root'#'localhost') does not exist"
Everything points to running a GRANT statement. I have tried various GRANTs as suggested, but I always get this error:
Access denied for user
It seems like my permissions got corrupted or something. So I created a brand new DB user inside BlueHost control panel on my VPS and gave full privileges. I get the same exact errors on this brand new user.
BlueHost support has no idea what to do.
Some Stack articles say to go mess around with TRIGGERS or STORED PROCS permissions - but I don't have any of these types of objects. Simple INSERT statements cause this error, and perhaps UPDATEs as well, but I'm not sure of that at this moment.
The user has FULL PRIVILEGES, as always.
What else can I try? Is there some way to fix corrupted permissions? I can run SELECT statements with no problems.
I tried connecting to the DB with root (using the same pwd as I use when connecting to WHM), but it didn't like my password or maybe the user in general. I never set up root as a specific user against this DB and I'm not sure that's a good idea. I have always used a specific user created just for this DB. Again, past 5 years no problems at all. The DB has not been upgraded, no DB changes, no user changes, nothing.
I sort of solved it. I ended up creating a new database with a different name, and created a new admin user to go with it. Then I ran my db backup/dump script against it. Everything works perfectly again, with this new DB. The old DB is still jacked.
I'm thinking that permissions got corrupted in the old database.

Why does SQL foribben to execute SELECT query?

I try to execute query in phpmyadmin and get error:
#1142 - SELECT command denied to user 'cpses_tkdpmnyjWW'#'localhost' for table 'user'
So, user cpses_tkdpmnyjWW'#'localhost is created dynamically and I can not set privileges for this user.
How to fix this?
Use SHOW GRANTS to show your current user privileges. It sounds as though the output may be similar to:
GRANT USAGE ON *.* TO 'Unnamed'#'localhost'
This would mean the account could sign into the server but do little else. This page gives a more detailed breakdown, as you'll see there are quite a few permutations.
The solution is you need to either find an account with more privileges or create/update one.
If the above is not an option, one quick trick I may try is connecting to '127.0.0.1' instead of 'localhost'. In MySQL the source of the connection can form part of the username so it's plausible that connecting on an IP instead of socket if you are on Unix flavoured OS.
Additionally, if you have admin/root access to the server, it is possible to create users when MySQL starts which is very useful in some scenarios.

Followed adwice for err 1045 but new problems Have made Grant statement too

wamp local
Lost contact with all dbases except one which I can log in to. In that DB my password is on a databas level and not a grant user. I have checked all earlier answers. First I did get error 1045 and took the advice given to use "cookie" instead of config in phpmyadmin config.inc
Logged in to phpmyadmin and got two other errors
needs a secret blowfish..??
Something wrong in config file. Doesn't say which and no more info
Fixed them(realy dont know how)
Have made The grant privileges statement for root.
Now I can come in with root user bud also every other user with or without password.
Then I can see my databases and tables(only titles)
I have checked that my DB files are still under the folders(msql bin data)
Got a message Before about something wrong in the config file. Checked it several times(config.inc.php) without seeing anything suspect.
Please... What to do?
I'm not really sure what your question is. It sounds like you worked through items 1 and 2. Sounds like you're logging in as root (as expected) and as the anonymous user (that's "every other user with or without password"). You can restrict that by removing the anonymous user (log in as root and click on the Users tab).

MySQL user with ALL PRIVILEGES can login but not run queries

We've configured our Plesk machine to use an external MySQL server. In doing so, we've granted ALL privileges WITH GRANT OPTION to the psaadmin user so we are able to create remote databases and users just fine. However, the users we create (i.e. 'wordpress_user') cannot run select statements on the remote server.
In checking permissions on the MySQL server, 'wordpress_user' has ALL PRIVILEGES to the database itself. I'm able to login to phpMyAdmin with that user and I'm able to login on the remote server console with that user. It's only when I try to run any query as that user that I get a 'ERROR 1045 (28000): Access denied for user' error.
Everything I've checked seems to indicate the user has full permissions. I've also used FLUSH PRIVILEGES as instructed by the docs. I've restarted Plesk, restarted MySQL, still nothing.
Can anyone help? Please?
I was able to find the problem. Apparently the problematic query was a view that had specific permissions? Regular selects, etc. worked fine (I didn't realize that). I was able to drop and recreate the view and it works great now.

MySql Strange Runs Of Command Denied Errors

I have an intermittent problem with a MySql database.
Everything runs just fine for long periods of time, but then we suddenly get a run of errors being logged such as this:
MySql.Data.MySqlClient.MySqlException: UPDATE command denied to user
'user'#'ip.add.ress' for table 'tblTable'
The user being reported is the correct user. The same user works just fine almost all the time, but when we get this error we get a load all at once.
I know this is vague, but I have checked that the permissions exist, and indeed the same code, using the same user works almost all the time.
Confirmation: We are not restricting access by IP - it's just a user name and password.
Just to close this one out. We solved this issue by granting the same user elevated permissions (i.e. against the MySQL instance as well as the specific database).