Skip to content

Instantly share code, notes, and snippets.

@boobo94
Last active May 11, 2018 14:29
Show Gist options
  • Save boobo94/bdf691edde8da3b4f319781a6d4545d6 to your computer and use it in GitHub Desktop.
Save boobo94/bdf691edde8da3b4f319781a6d4545d6 to your computer and use it in GitHub Desktop.
Setup mysql to connect remotly on Ubuntu

Install Mysql on Ubuntu

  1. $ sudo apt-get update
  2. $ sudo apt-get install mysql-server Mysql will ask for root password

Use mysql

$ mysql -u root -p Will ask for root password

Grant Permission for connect remotly to mysql

  1. $ mysql> GRANT ALL PRIVILEGES ON DBNAME.* TO 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

Check grants $ mysql> SELECT * from information_schema.user_privileges where grantee like "'USERNAME'%";

  1. $ mysql> FLUSH PRIVILEGES;

  2. Comment this line #bind-address = 127.0.0.1 from file /etc/mysql/mysql.conf.d/mysqld.cnf OR sudo vi /etc/mysql/conf.d/mysql.cnf and add bind-address = 0.0.0.0

  3. $ ~ /etc/init.d/mysql restart

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