Skip to content

Instantly share code, notes, and snippets.

@rodrigo-galba
Last active December 22, 2015 04:08
Show Gist options
  • Save rodrigo-galba/6414493 to your computer and use it in GitHub Desktop.
Save rodrigo-galba/6414493 to your computer and use it in GitHub Desktop.
Mysql - enable access remote (for dev environment!)
$ sudo vim /etc/mysql/my.cnf
#comment out this line (add # in front of the line)
#bind-address = 127.0.0.1
$ sudo service mysql restart
mysql stop/waiting
mysql start/running, process 13081
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 77
Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> grant all on [database_name].* to [user]@[ip_address] identified by '[password]'
// example user "testuser" (for all hosts)
mysql> grant all on mydatabase.* to testuser@'%' identified by 's3cr3t'
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
# source http://andrewpakpahan.blogspot.com.br/2012/08/how-to-enable-mysql-remote-access-on.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment