I was googling about how to create a user and grant all privileges to him.
I found these two methods :
The first method :
create user userName identified by password; grant connect to userName; grant all privileges to userName;
The second method :
grant connect , resource to userName identified by password;
So what's the difference between those two methods ?
Database-Specific Privileges To GRANT ALL privileges to a user , allowing that user full control over a specific database , use the following syntax: mysql> GRANT ALL PRIVILEGES ON database_name. * TO 'username'@'localhost';
Use the ALL PRIVILEGES privilege type to grant all of the privileges to the user or role for the specified table. You can also grant one or more table privileges by specifying a privilege-list. Use the DELETE privilege type to grant permission to delete rows from the specified table.
There are 2 differences:
2 methods creating a user and granting some privileges to him
create user userName identified by password; grant connect to userName;
and
grant connect to userName identified by password;
do exactly the same. It creates a user and grants him the connect role.
different outcome
resource is a role in oracle, which gives you the right to create objects (tables, procedures, some more but no views!). ALL PRIVILEGES grants a lot more of system privileges.
To grant a user all privileges run you first snippet or
grant all privileges to userName identified by password;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With