InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

AWS and EC2

  • AWS benefits
  • Broken sudoers file
  • EBS and reliability/durability
  • EC2 api tools on Ubuntu
  • How to extend disk (EBS) size on Amazon Linux
  • Install wordpress AWS Classic Ubuntu
  • Linux instance on AWS Classic
  • Mysql access
  • Mysql service and micro instance
  • Route53 as DNS
  • Upgrade Linux micro instance to small
  • ssh automation
 
  • Home
  • > Tutorials
  • > AWS and EC2

How to allow mysql access on AWS/EC2 from a specific IP

By admin | Last updated on Jun 12, 2016

If you have mysql server on AWS EC2 instances, you may need remote access to mysql server form a specific IP. Note that if you need access between two AWS instances, it is better to use security groups. Here are the steps to allow access from a specific IP:

  • Open /etc/mysql/my.cnf on the instance where you have mysql server change
    bind-address           = 127.0.0.1
    to
    bind-address            = 0.0.0.0
  • Goto security group settings on mysql hosting EC2 instance (on https://console.aws.amazon.com/ec2) and add the following:
    3306  (MYSQL) CLIENT_IP/32
    (CLIENT_IP is ip of the IP from where you want to access mysql from)
    aws_mysql_security_group_settings
  • Once this is done, click on apply rule changes in security group for these changes to take effect.
    aws_mysql_security_group_apply_rule_changes
  • To test if everything is fine, run this from client machine:
    telnet MYSQL_INSTANCE_IP 3306.
    If you see the following, then it means the port access stuff is fine.
    Connected to mysqlserver.com.
    Escape character is ‘^]’.
  • After this you will need to create a mysql user (avoid using root for remote login) and grant it appropriate privileges. e.g. you can create a “writer” user for host “%” and that will let write connect to mysql from other hosts.

Note that this article was written for AWS classic. In case of AWS vpc, instructions may be slightly different. And these instructions should only be used when you are sure that the accessing IP is static and never changes. Otherwise you may have to update the settings every time IP changes which is error prone.

Suggested posts:

  1. How to migrate wordpress from root to sub directory
  2. How to fix a broken sudoers file on AWS/EC2 Linux
  3. Setup xdebug for remote wordpress debugging
  4. How to find mysql query rate on Linux
  5. Chrome – copy any request as cURL including headers
  6. Linux – find files containing specific text
  7. WordPress themes for beginners worth considering
  8. Linux – find top directories by used disk size (excluding size of subdirectories)
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged AWS and EC2, Cloud, Devops Interview Questions, Mysql, Tutorials
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress