To create a MySQL user and grant permissions in Amazon Web Services (AWS) Relational Database Service (RDS), you can follow these steps:
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.
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.
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.
FLUSH PRIVILEGES;
exit
You can now use the new user account to connect to the RDS instance and access the database with the granted permissions.