Skip to content

Instantly share code, notes, and snippets.

@kymtwyf
Last active January 16, 2016 06:41
Show Gist options
  • Save kymtwyf/108c072da481cf4ebf84 to your computer and use it in GitHub Desktop.
Save kymtwyf/108c072da481cf4ebf84 to your computer and use it in GitHub Desktop.
enable mysql for remote access, mysql , mysql remote access

Reference

1. grant access to user

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'YOUR PASSWORD';

2. enable iptables for port 3306(default port)

sudo iptables -A INPUT -i YOUR_NETCARD_INTERFACE(e.g. eth0) -p tcp --destination-port 3306 -j ACCEPT

3. change bind-address

Detailed explain about why

sudo vim /etc/mysql/my.cnf

modify bind-address = 0.0.0.0

4. restart mysql

sudo /etc/init.d/mysql restart

it's DONE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment