How to create MySQL user and grant permissions in AWS RDS

‮.www‬lautturi.com
How to create MySQL user and grant permissions in AWS RDS

To create a MySQL user and grant permissions in Amazon Web Services (AWS) Relational Database Service (RDS), you can follow these steps:

  1. Connect to the RDS instance using the mysql command-line client. You will need to use a user account with administrative privileges to do this.

  2. Create a new user account using the CREATE USER statement. Replace username with the desired username and password with the desired password:

CREATE USER 'username'@'%' IDENTIFIED BY 'password';

This will create a new user account called username with the password password, and allow it to connect from any host.

  1. Grant the new user permissions on the desired database using the GRANT statement. For example:
GRANT SELECT, INSERT, UPDATE, DELETE ON mydatabase.* TO 'username'@'%';

This will grant the user permissions to select, insert, update, and delete data in the mydatabase database.

  1. Flush the privileges to apply the changes:
FLUSH PRIVILEGES;
  1. Exit the MySQL client:
exit

You can now use the new user account to connect to the RDS instance and access the database with the granted permissions.

Created Time:2017-10-28 21:39:01  Author:lautturi