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 the user. you can remove user permission from the 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.

How To Revoke Access From User In MySQL CentOS 7:

Let’s begin the process, MySQL server is the 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 a database

create database testing;
create database prepare;

create database

Check Out: How To Make EBS Volume To Use On AWS Cloud

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 the database to grant permission for the test users.

use prepare;
grant all privileges on prepare to 'test'@'localhost' identified by 'password';
flush privileges;

use database

Step 3: So test users 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 the ”test’ user.

revoke user privileges mysql

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.

user permissions remove

YouTube Link: Database Revoke Permission

You’re done

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment