How can permissions be granted to a user in MySQL?

In MySQL, you can use the GRANT statement to grant permissions to users. Here are some common examples of GRANT statements.

  1. Grant all permissions to the user.
  2. Give ‘username’@’localhost’ full access to the database named database_name.
  3. Grant users specific permissions.
  4. Provide ‘username’@’localhost’ with permission to select, insert, update, and delete data in database_name.table_name.
  5. Grant the user permissions to all databases.
  6. Give the user ‘username’ all privileges on all databases on the localhost.
  7. Granting users remote access permissions:
  8. Give full access to all privileges on the database named database_name to the user with the username ‘username’ from any location, using the password ‘password’.
  9. Refresh permission:
  10. Reload the privileges.

Before using the GRANT statement, make sure you have sufficient permissions to grant permissions to other users.

bannerAds