6

When this is executed

SELECT count(*) FROM hisrec

this error appears

View 'tablet_001.hisrec' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

if this is executed

SELECT COD FROM hisrec

the same error appears

but if this is executed

SELECT * FROM hisrec

all works fine :S

Why??

im root.... with all privileges!

2
  • 1
    How is hisrec defined? Aug 9, 2013 at 13:20
  • is a normal view, in any computers the same view (other servers) work fine, but in some clients fail... (sorry for my english) Sep 29, 2014 at 11:26

3 Answers 3

6
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_SCHEMA = 'tablet_001' AND TABLE_NAME = 'hisrec';

Check out your view and see what is the problem,if you don't know post it here.

1
  • 1
    I'm just curious, is there anything special in this command that SHOW CREATE VIEW hisrec \G couldn't retrieve?
    – cezar
    Jan 23, 2019 at 12:28
0

I had similar issue on mysql 5.6.x.

select * from view worked.

select count(*) from view resulted in OP's error message.

Resolved by taking Order By clause out of the select ... in the view definition.

2
  • That should have been "select count(*) from view" Feb 15, 2014 at 17:32
  • 1
    You can edit your original post...that is much more useful for future readers than adding a comment. Thanks! Feb 15, 2014 at 17:51
0
  • I was facing the same error. That error is because user(other than root user) does not have permission to use that table.
  • so first grant permission to user to use that table. Grant permission using root user.
grant select on database_name.table_name to user@localhost ;

In the same way you can grant permission for update or insert.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.