Saturday, September 25, 2021

User Management in MySQL

 In this article we will cover how to create Admin, Read and Write access user in MySQL.


1. To see all the user in mysql:

select user,host from mysql.user;

2. To create an Admin user

create user 'Adminuser'@'%' identified by 'Admin@123';

grant all on *.* to 'Adminuser'@'%' with grant option;

flush privileges;

3. To see all the permission of the user

select * from mysql.user \G;

4. Create write access user for a Particular Database

create user 'writeuser' identified by 'Write@123';

grant select,insert,update,delete on laptop.* to 'writeuser';

flush privileges;

In above example we are creating writeuser and giving the user permission to use all the tables on laptop database.

5. To create a Read user

create user 'readuser'@'%' identified by 'Read@123';

grant select,show view on *.* to 'readuser'@'%';

flush privileges;


Thanks,

No comments:

Post a Comment