Jump to content

[Solved] sql priviledges issue


kanvull

Recommended Posts

Hi. I'm trying to figure out how functions and procedures works into MariaDB. And i creared a sinple function:

BEGIN
	declare ans TEXT;
    select answer into ans from text_answers ORDER by rand() limit 1;
    RETURN ans;
END

and wanted to call this function by:

SELECT * from dbo.random_text_answer

but i've got a error of loss privileges... 

Quote

#1142 - SELECT command denied to user 'kanvull_main'@'localhost' for table `dbo`.`random_text_answer`

i wanted to try to check "Adjust privileges" in edit window, but this checkbox is unactive..

What should I do in this case?

Link to comment
Share on other sites

I'm assuming in the SELECT you remembered to actually replace "dbo" with the real database name? I was able to run the function as below through PhpMyAdmin and got a response from the function:

SELECT `DATABASE_NAME_HERE`.`random_text_answer`();

The user kanvull_main is assigned to the database, so while I can't test using that user easily, I see no reason it wouldn't work provided the database name is correct in the SELECT statement.

  • Like 1
Link to comment
Share on other sites

14 hours ago, wolstech said:

I'm assuming in the SELECT you remembered to actually replace "dbo" with the real database name? I was able to run the function as below through PhpMyAdmin and got a response from the function:

SELECT `DATABASE_NAME_HERE`.`random_text_answer`();

The user kanvull_main is assigned to the database, so while I can't test using that user easily, I see no reason it wouldn't work provided the database name is correct in the SELECT statement.

Yes, it really helpfull for me. Thank you. I should read documentation more attentively)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...