Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create view without SUPER privileges in phpMyAdmin [duplicate]

I am trying to via SQL tab within the phpmyadmin to create/import a view like this:

CREATE ALGORITHM=UNDEFINED DEFINER=`byname`@`localhost` SQL SECURITY DEFINER VIEW `wr_averages` AS select `nf_users`.`id` AS `id`,(`nf_users`.`points` / `nf_users`.`played`) AS `average_points` from `nf_users` where (`nf_users`.`played` > 24);

I get this error:

#1227 - Access denied; you need the SUPER privilege for this operation

I can not get SUPER privileges at my hosting company, so is there anyway to get around this?

Thanks in advance :-)

like image 305
Mansa Avatar asked Nov 21 '12 12:11

Mansa


People also ask

How do I get super privileges in phpMyAdmin?

To add super privileges to MySQL database, the following is the syntax. mysql> GRANT SUPER ON *. * TO user@'localhost' IDENTIFIED BY 'passwordName'; After executing the above query, do not forget to end it with the following command.

How do I delete privileges in phpMyAdmin?

To revoke all privileges, use the second syntax, which drops all global, database, table, column, and routine privileges for the named users or roles: REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_or_role [, user_or_role] ... REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke any roles.

What is super privilege in MySQL?

SUPER can be used to terminate other sessions or change how the server operates. Privileges granted for the mysql system database itself can be used to change passwords and other access privilege information: Passwords are stored encrypted, so a malicious user cannot simply read them to know the plain text password.

How do I change user privileges in phpMyAdmin?

To edit an existing user, simply click the pencil icon to the right of that user in the User accounts page. You can then edit their global- and database-specific privileges, change their password, or even copy those privileges to a new user.


1 Answers

From the documentation:

If you specify the DEFINER clause, you cannot set the value to any user but your own unless you have the SUPER privilege. These rules determine the legal DEFINER user values:

  • *If you do not have the SUPER privilege, the only legal user value is your own account, either specified literally or by using CURRENT_USER. You cannot set the definer to some other account.*
  • If you have the SUPER privilege, you can specify any syntactically legal account name. If the account does not actually exist, a warning is generated.

Check your MySQL account, it is not byname@localhost.

Solutions:

  • Create new view with DEFINER clause using account that granted with SUPER privilege.
  • Do not use DEFINER clause in CREATE VIEW, in this case MySQL will create view DEFINER = CURRENT_USER.
like image 112
Devart Avatar answered Nov 15 '22 16:11

Devart