Connect to MySQL Server on Linux From Windows

Database

Here I come with quick tip. This is about when you find problem when your MySQL Server is running on Linux machine and you are trying to connect from Windows Machine.

You might think its should not be a problem, but the fact is that, you will face problem when you have such condition where MySQL Server is on Linux Machine and you try to connect from different or Windows Machine. Let me explain you the reason for the same.

Main reason for this problem bind-address setting in MySQL Configuration File. bind-address parameter is used to let MySQL Server know from which server it can accept TCP/IP connections. You got the problem now? If not yet then continue reading.

So when you setup the MySQL server on Linux machine, it sets MySQL Server to accept connection from local IP only (i.e 127.0.0.1). So it allow TCP/IP connection from same machine only.

1
2
  # Local Machine Only
  bind-address=127.0.0.1

What to Change?

As per the above code it will allow connections from Local machine only. So now if you want to allow from specific IP then you can assign that IP over here. You need to make one alteration in my.cnf file.

1
2
  # Specific IP
  bind-address=57.58.25.1

But what if you want to allow connections from any IP? You just need to set the IP to 0.0.0.0, have a look at below code block for the same.

1
2
  # All IP
  bind-address=0.0.0.0

Once you are done with editing the MySQL Configuration file, you need to restart the MySQL Service. You can use below command for the same in terminal.

1
  sudo /etc/init.d/mysql restart

You will need ROOT permission to execute above command.

Have you ever gone through above situation? If Yes then Share with all for how you have handeled the situation. Because sharing is caring.

0 0 vote
Article Rating

Tags: #mysql

Related Post

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments