HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to grant permission to new user created in mysql?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
newcreateduserpermissiongrantmysqlhow

Problem

I want to create new user and want to give them specific permission like inset, update and delete.
But how to create new user and give them permission i don't know.

Any help please.

Solution

It would be something like this :

GRANT SELECT, INSERT, DELETE ON database TO username@'localhost' IDENTIFIED BY 'password';


To see a list of the privileges that have been granted to a specific user:

select * from mysql.user where User='username';


OR

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

Code Snippets

GRANT SELECT, INSERT, DELETE ON database TO username@'localhost' IDENTIFIED BY 'password';
select * from mysql.user where User='username';
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

Context

StackExchange Database Administrators Q#56331, answer score: 5

Revisions (0)

No revisions yet.