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.
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;
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';
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;
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
As you can see test user is able to see both databases.
You can see the database permission for the ”test’ user.
Now I will remove prepare database permission from test user.
revoke all on prepare from test@localhost;
revoke all privileges on testing from 'test'@'localhost';
user test does not have permission on the database prepare.
YouTube Link: Database Revoke Permission