Search code examples
mysqlsqlphpmyadmineasyphp

SQL Grant SELECT


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?


Solution

  • Solved it with

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