Skip to content

Instantly share code, notes, and snippets.

@ncole458
Created June 4, 2018 01:39
Show Gist options
  • Save ncole458/481c320ec9a0deccbd6a99fdb5eb07a0 to your computer and use it in GitHub Desktop.
Save ncole458/481c320ec9a0deccbd6a99fdb5eb07a0 to your computer and use it in GitHub Desktop.
Grant remote access to MySQL database
# UPDATE AWS EC2 SECURITY GROUPS FIRST TO ALLOW MySQL CONNECTION VIA IP
---
# Edit /etc/mysql/my.cnf, and change the binding address to 0.0.0.0
bind-address = 0.0.0.0
# then restart mysql server
$ sudo /etc/init.d/mysql restart
# Create a new user for any host in MySQL
CREATE USER 'your_user'@'%' IDENTIFIED BY 'your-unique-password';
# grant privileges to table(s)
GRANT ALL PRIVILEGES ON database_name.* TO 'your_user'@'%' WITH GRANT OPTION;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment