revoke database access from user

How To Revoke Access From User In MySQL CentOS 7

I have created two databases and i will provide full access to both databases to both users and then i will revoke the database permission. Let’s see how to revoke access from user. you can remove user permission from database. This can help you to revoke user privileges MySQL. 

Check Out : Grant Permission On Database In MySQL Server

Suppose by mistakenly, you have given database permission to the user and now you need to revoke it. So, you can do this with revoke command only. you can also revoke user privileges MySQL from a particular database.

Let’s begin the process, MySQL server is most widely used RDBMS database server available in today’s market. There’re many databases like PostgreSQL, NoSQL and Redis. NoSQL server like mongodb stores the data in document format.

Step 1 : Create database

create database testing;

create database prepare;

create database

Step 2 : Grant privileges to user ‘test and ‘tod’.

grant all privileges on testing to ‘test’@’localhost’ identified by ‘password’;

grant privileges

Switch to prepare database to grant permission for test user.

use prepare;

grant all privileges on prepare to ‘test’@’localhost’ identified by ‘password’;

flush privileges;

use database

Step 3 : So test user should be able to see or access both databases and check this by login test user.

mysql -h localhost -u test -ppassword

Check Out : How To Enable MySQL General Query Log On Linux

As you can see test user is able to see both databases.

access database

You can see the database permission for ”test’ user.

database permisison

Check Out : How To Change User Password In MySQL Server 5.x

Now i will remove prepare database permission from test user. 

revoke all on prepare from test@localhost;

Or else

revoke all privileges on testing from ‘test’@’localhost’;

revoke database permission

user test does not have permission on the database prepare.

check permission on user

YouTube Link : Database Revoke Permission

You’re done

Leave a Reply

Notify of