MySQL and MariaDB are popular open-source relational database management systems that are widely used for web development and other applications. They allow for the creation and management of users with different levels of permissions to access and manipulate the data stored within the databases. When it comes to managing user privileges, it's important to ensure that users have the appropriate level of access to maintain the security and integrity of the database.
There may be instances where it becomes necessary to remove certain permissions from users, such as when their role within an organization changes or their access level needs to be reduced for security reasons. In such cases, knowing how to remove permissions from MySQL or MariaDB users is crucial.
This step-by-step guide will demonstrate how to remove permissions from MySQL or MariaDB users using simple SQL commands. By following the steps below, you'll be able to easily revoke privileges from a user, ensuring that your database remains secure and well-managed.
mysql -u root -p
REVOKE SELECT, INSERT ON database_name.* FROM 'username'@'localhost';
REVOKE ALL PRIVILEGES ON *.* FROM 'username'@'localhost';
REVOKE GRANT OPTION ON *.* FROM 'username'@'localhost';
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'username'@'localhost';
EXIT;
Comment anonymously. Login not required.