Update: February 2017
Here are the FULL STEPS for remote access to MySQL (deployed on Amazon EC2):
1. Add MySQL to the inbound rules.
Go to the security group of your ec2 instance -> edit incoming rules -> add a new rule -> select MySQL/Aurora and the source in Anywhere .
2. Add bind-address = 0.0.0.0 to my.cnf
In the console console:
sudo vi /etc/mysql/my.cnf
this will open the vi editor.
in the my.cnf file after [mysqld] add a new line and write:
bind-address = 0.0.0.0
Save the file by typing :wq (enter)
Now restart MySQL:
sudo /etc/init.d/mysqld restart
3. Create a remote user and grant rights.
enter MySQL:
mysql -u root -p mysql (enter the password after that)
Now write the following commands:
CREATE USER 'jerry'@'localhost' IDENTIFIED BY 'jerrypassword'; CREATE USER 'jerry'@'%' IDENTIFIED BY 'jerrypassword'; GRANT ALL PRIVILEGES ON *.* to jerry@localhost IDENTIFIED BY 'jerrypassword' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* to jerry@'%' IDENTIFIED BY 'jerrypassword' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT;
After that, you can gain remote access to MySQL dB by entering the public dns / ip of your instance as the MySQL host address, username as jerry and password as jerrypassword. (The default port is set to 3306)
JerryGoyal Feb 07 '17 at 13:58 on 2017-02-07 13:58
source share