How to allow remote connection to mysql

Lakshani Gamage
1 min readJan 6, 2020

--

By default, In MySQL, remote access is disabled.

First, execute below SQL command to enable all the privileges. Here, I’m using “root” as the user and “abc123” as the password.

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'abc123' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Then open /etc/mysql/my.cnf from Unix/OSX systems. If it’s a Windows system, you can find it in the MySQL installation directory, usually, something like C:\Program Files\MySQL\MySQL Server 5.5\ and the filename will be my.ini

And then find the following line from my.inf and comment out .

Change line

bind-address = 127.0.0.1

to

#bind-address = 127.0.0.1

Then, restart MYSQL server for the changes to take effect.

--

--

Lakshani Gamage
Lakshani Gamage

Written by Lakshani Gamage

I am Lakshani Gamage, a post graduate from the University of Colombo, School of Computer. I’m working as a Senior Software Engineer at Mitra Innovation.

No responses yet