How to remote access Mysql server

Awixor
2 min readFeb 17, 2019

--

Hello everyone,

Today I’m gonna explain how to establish connection to Mysql server remotly.

I will use windows 8 and a virtual machine (Ubuntu 16.4)

The Mysql server should be installed in both sides.

I will assum that you have already installed Mysql server.

Follow these steps:

Ubuntu side:

1)- Create a user called “admin” with a password “1234” in Mysql server by typing this cammands:

mysql> CREATE USER admin@‘%’ IDENTIFIED BY ‘1234’;

the ‘%’ in this command is to tell that this admin can access from any host you can remplace it with the ip address of you host machine.

2)- Give our user the privileges to manage any database with tha cammand:

mysql> GRANT ALL PRIVILEGES ON *.* TO admin@‘%’ WITH GRANT OPTION;

also you can change the privileges on what database you want the user to manage by changing the ‘*.*’ .

To verify you will find everything in mysql.user table.

3)- Now lets change some configuration in Mysql server conf file:

open this file with sudo: /etc/mysql/mysql.conf.d/mysqld.cnf

And search for this line where is says: bind-address=127.0.0.1 and comment it by adding # in the beginning just like this:

Windows side:

open the cmd.exe and type:

mysql -u admin -h 192.168.58.128 -p

in which admin is the name of our user that we’ve created.

192.168.58.128 is my ubuntu machine IP address.

and click ENTER enter the password for the user admin. which is 1234 for us here.

We are done, the connection should be established :).

thats it, I hope that was helpful for you.

--

--

Awixor
Awixor

Written by Awixor

I’m a self-taught Designer & Front-end Developer specializing in building and sometimes designing exceptional websites, applications, and everything in between.

No responses yet