Skip to content

Instantly share code, notes, and snippets.

@trejo08
Last active November 3, 2015 02:13
Show Gist options
  • Save trejo08/c7accd2e745f697a9d83 to your computer and use it in GitHub Desktop.
Save trejo08/c7accd2e745f697a9d83 to your computer and use it in GitHub Desktop.
Allowing remote acces to MySQL Step by Step
This is a Guide to Enable remote access to MySQL Server, allowing remote administration and sharing databases.
This guide has been tested in Ubuntu desktop/server 14.04
Run the following commands in a terminal
1- sudo apt-get update
2- sudo apt-get upgrade
3- sudo apt-get install -y mysql-server mysql-common mysql-client libmysqlclient-dev
After mysql has been installed and configured successfully and setted 'root' password, change and comment the following file with an editor(nano, emacs, vi, vim) with 'sudo' logged as admin user or root:
file: sudo nano /etc/mysql/my.cnf
change the following line:
change FROM: bind-address = 127.0.0.1 TO: ## bind-address = 127.0.0.1
Now, run the follow command:
sudo service mysql restart
If MySQL has been restarted successfully then proceed to create a remote user for connect:
1- mysql -u root -p<your_password>
2- CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
3- CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
then:
3- GRANT ALL ON *.* TO 'myuser'@'localhost';
4- GRANT ALL ON *.* TO 'myuser'@'%';
then:
5- flush privileges;
If the line above not return problems, your MySQL is ready to be administered remotely
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment