If this is the case then you can easily open up the port for the security group in a few button clicks:
1) Log into you AWS Console and go to ‘EC2’
2) On the left hand menu under ‘Network & Security’ go to ‘Security Groups’
3) Check the Security Group in question
4) Click on ‘Inbound tab’
5) Choose ‘MYSQL’ from drop down list and click ‘Add Rule’
- START MYSQL using admin user
- mysql -u admin-user -p (ENTER PASSWORD ON PROMPT)
- Create a new user:
- CREATE USER ‘newuser’@’%’ IDENTIFIED BY ‘password’; (% -> anyhost)
- Grant Privileges:
- GRANT SELECT,DELETE,INSERT,UPDATE ON db_name.* TO ‘newuser’@’%’;
- FLUSH PRIVILEGES;
If you are running EC2 instance don’t forget to add the inbound rules in security group with MYSQL/Aurura.
Update the mysql binding address
Edit the file /etc/mysql/my.cnf
, and change the binding address to 0.0.0.0
1 | bind-address = 0.0.0.0 |
then restart mysql server
sudo /etc/init.d/mysqld restart
login to MySQL:
mysql -u root -p mysql
(enter password after this)
Now write following commands:
CREATE USER 'foo'@'%' IDENTIFIED BY 'your-awesome-pass';
# grant privileges to table(s)
GRANT ALL PRIVILEGES ON db_name.* TO 'foo'@'%' WITH GRANT OPTION;