Allow Remote MySql Connection On Ubuntu Server

Installing Lamp on ubuntu server
30 December 2016

How to create remote mysql connection on ubuntu

We can enable Mysql Remote connection on ubuntu through 2 simple steps.

Step1:- Change Bind Address
By default mysql is configured to listen only localhost but we have to change Mysql config file to allow Mysql to listen from remote connection. For that we have to edit config file and change bind address from 127.0.0.1 to 0.0.0.0 . we can edit file by typing following command:-

~/Server $ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Now we have to restart mysql server and we can do that by typing following commands:-

~/Server $ sudo service mysql restart

Step2:- Create Mysql User
Now we are done with 1st step we can create a wild card user to allow remote connection and we can do that by following commands:-

~/Server $ mysql -u root -p
mysql> Create user 'username'@'%' identified by 'password';
mysql> Grant all privileges on *.* to 'username'@'%';
mysql> Flush privileges;


You are all set to connect to mysql through remote connection. The default port for mysql is 3306. So you can connect mysql at http:\\your_ip_address:3306 through wildcard username and password you created.


By Lakshay Jain

Tags: Cloud