Pergunta

I want to create a user and only allow them to use select statements on the cameracircle database. So I have the following code:

CREATE USER 'hoeym'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE cameracircle;
GRANT SELECT ON cameracircle TO 'hoeym'@'localhost';

But the phpmyadmin doesn't like that. If I run this it says there is an error cause I don't have a databases selected, and if I add in USE cameracircle; before the GRANT statement it says that there is no table inside the database with the same name as the database. What have I done wrong?

Foi útil?

Solução 2

Solved it with

GRANT SELECT ON cameracircle.* TO 'hoeym'@'localhost';

Outras dicas

Before you issue a GRANT statement, check that the

derby.database.sqlAuthorization

property is set to true. The derby.database.sqlAuthorization property enables the SQL Authorization mode.

phpMyAdmin lets you do this graphically. From the Users tab, look for Add User then don't select anything for the Global Privileges area. Go ahead and create the user, then edit the privileges. Halfway down the page there's a area for "Database-specific privileges" where you can specify the permissions on a database (or even table-) level.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top