Tuesday, March 6, 2018

AWS RDS - Create mysql user with superuser Privileges

Login as super user on command prompt.

Run following query to create user.
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
Just change username and password in above query and execute as root user. A new user will be created.

Now give super user privileges to new user.
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'username'@'%' WITH GRANT OPTION;
Just change username in above query. Your new created user will be a super user now.

AWS RDS - Give Superuser Privileges to Regular mysql User

Login as super user on command prompt.

Run following query to give superuser privileges to normal user.
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'username'@'%' WITH GRANT OPTION;
Just change username in above query and execute as root user. Your regular user will be a super user now.

Wordpress Permissions - Upload plugin using wp-admin

Upload plugin using wp-admin without ftp.

If you are not able to install plugin using wp-admin because of forbidden error or a permission issue, you simply change the permission of whole wordpress directory to fix it. That is very dangerous and a common security loophole.

Here is the minimum permission for your plugin directory which is enough to instal plugin using wp-admin.

Give 777 to wp-content/plugins and wp-content/upgrade Non-Recursively. It will allow admin to install plugin using wp-admin.