mysql> flush privileges;
To update database permissions or privileges in MySQL, you typically use the GRANT
and REVOKE
statements. Here’s how you can do it:
- Granting Permissions: To grant permissions to a user, you can use the
GRANT
statement followed by the specific privileges and the database or tables the user should have access to. For example:
sql
GRANT SELECT, INSERT ON mydatabase.* TO 'myuser'@'localhost';
This grants the SELECT
and INSERT
privileges on all tables in the mydatabase
database to the user myuser
connecting from localhost
.
- Revoking Permissions: To revoke permissions from a user, you can use the
REVOKE
statement followed by the privileges and the database or tables from which you want to revoke access. For example:
sql
REVOKE SELECT, INSERT ON mydatabase.* FROM 'myuser'@'localhost';
This revokes the SELECT
and INSERT
privileges on all tables in the mydatabase
database from the user myuser
connecting from localhost
.
Remember to replace 'myuser'
and 'localhost'
with the actual username and hostname, and 'mydatabase'
with the actual database name as needed.