How do I grant privileges to a MariaDB user?

Question

Grade: Education Subject: Support
How do I grant privileges to a MariaDB user?
Asked by:
44 Viewed 44 Answers

Answer (44)

Best Answer
(425)
You can grant privileges using the `GRANT` statement. For example, `GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'host';`. `ALL PRIVILEGES` grants all permissions, while you can specify specific privileges like `SELECT`, `INSERT`, `UPDATE`, `DELETE`. The `host` specifies where the user can connect from (e.g., 'localhost', '%'). Remember to use `FLUSH PRIVILEGES;` after granting permissions to apply the changes.