473,775 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how do you close MySQL port 3306 except to localhost?

I want to run MySQL on server but it only be accessible to programs on
localhost. I see that port 3306 is open on server so I need to close
it.

How do I do that while keeping it available to programs running on
localhost?

Oct 11 '06 #1
4 27535
I think you can do this with your firewall. If you don't allow traffic
on port 3306 nobody from the outside will be able to connect to the
MySQL server, but apps running on localhost will still have access.

I am running MySQL on OS 10.4 and changing the firewall settings is
realy easy. I don't have much experience with other operating systems.
I hope this helps.
Paul wrote:
I want to run MySQL on server but it only be accessible to programs on
localhost. I see that port 3306 is open on server so I need to close
it.

How do I do that while keeping it available to programs running on
localhost?
Oct 11 '06 #2

to*******@yahoo .com wrote:
I think you can do this with your firewall. If you don't allow traffic
on port 3306 nobody from the outside will be able to connect to the
MySQL server, but apps running on localhost will still have access.

I am running MySQL on OS 10.4 and changing the firewall settings is
realy easy. I don't have much experience with other operating systems.
I hope this helps.
So it's a firewall issue rather than a MySQL setting issue, right? I
remember seeing in one MySQL table configuration where the % user was
not allowed any access and localhost was allowed all access or a subset
thereof.

Many thanks torpecool!

Oct 11 '06 #3
Paul wrote:
I want to run MySQL on server but it only be accessible to programs on
localhost. I see that port 3306 is open on server so I need to close
it.

How do I do that while keeping it available to programs running on
localhost?
One solution is to enable the option in your my.cnf file:

bind-address=127.0.0 .1

This means that only clients connecting from the specified IP address
are permitted to connect.

But this is not the same thing as closing port 3306 to the outside
world. A port-detection tool would still show the port as "open," even
though the application listening on the port (mysqld) will refuse all
connections unless they come from the local IP address.

So as torpedocool says, the better solution is to configure your
firewall rules in the way you want.

Regards,
Bill K.
Oct 11 '06 #4
Bill Karwin wrote:
Paul wrote:
I want to run MySQL on server but it only be accessible to programs on
localhost. I see that port 3306 is open on server so I need to close
it.

How do I do that while keeping it available to programs running on
localhost?

One solution is to enable the option in your my.cnf file:

bind-address=127.0.0 .1

This means that only clients connecting from the specified IP address
are permitted to connect.

But this is not the same thing as closing port 3306 to the outside
world. A port-detection tool would still show the port as "open," even
though the application listening on the port (mysqld) will refuse all
connections unless they come from the local IP address.

So as torpedocool says, the better solution is to configure your
firewall rules in the way you want.

Regards,
Bill K.
I understand now and thanks for your reply. A day without learning
something is like a day without sunshine!

Oct 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
631
by: Steve Carson-Rowland | last post by:
I have tried to install MySQL 4.0.14 on my Pentium 1.7Ghz running WindowsXP Professional. the installation ran through without any problems. However, every command gives an error: C:\mysql\bin>mysql ERROR 2003: Can't connect to MySQL server on 'localhost' (10061) C:\mysql\bin>mysql --install
0
1369
by: Michael Wang | last post by:
I only use mysql locally. I want to - close port 3306 if possible (like starting Oracle database without starting listener), - or bind it to localhost only (like what sendmail does), - or next best thing for security. I am on redhat 9, and use mysql 3.23.55. I can upgrade if newer
1
3430
by: Reply-Via-Newsgroup Thanks | last post by:
Folks, I have a server at an ISP - I've got port 3306 open in the firewall so that I can work from remote however its got me thinking if its safe? I know Microsoft got hit with slammer (or whatever) worm on their unpatched machines that were exposed to the outside world, but I'm trying to measure up the risks by having my db server exposed for a few weeks. Anyone offer any comment?
1
1733
by: Paul Muns | last post by:
I have got the server working on Win XP Pro according to Winmysqladmin.exe. I have a password in my.ini but when I go to CMD to login to root, it gives me: "ERROR 1045: Access denied for user: 'root@localhost' <Using password: YES>" I am the system admin. I am however not using 'localhost' as such since I am behind a router that has assigned this workstation: 192.168.0.3. The USER and HOST are clearly shown in winmysqladmin.exe, like...
0
2302
by: ryanmhuc | last post by:
I have root access to this server which has been preconfigured. I can connect using the mysql command tool. But I cannot connect using any mysql GUI software (I am currently tunneling the 3306 port to 3306 on the server using SSH). So i ran mysqladmin variables. And got the following: port 0 instead of the usually port 3306. Obviously I cannot connect on port 0. How can I troubleshoot this and get mysql running so I can connect via
2
2014
by: Sezgin | last post by:
Hi Everyone, How can I close Serial Port opened by another program. Regards.
3
8271
by: ricolee99 | last post by:
Hi Everyone, I'm using the System.IO.Ports.SerialPort component to attempt to kill an existing component opened by another application. I use the following code: SerialPort serialPort = new SerialPort ("COM1"); if(serialPort.IsOpen)
1
13465
by: Nabarun | last post by:
I have discovered a new thing as a solution for MySql error 10061 (error 2003) where if port 3306 is busy then service cannot run message comes The solution I found is go to mysql/bin type mysqld port 3305(or any port which is vacant) and then mysql runs I need any expert to verify it and authenticate it
3
5232
by: Suresh P | last post by:
Hi All, I tried to access the mysql database in ODBC using ip address and username/password. It returns, "cannot connect to MySQL server on IP ADDRESS(10060)". This could be related to Firewall on the server. Is there anyway to access MySQL database using ODBC without opening port 3306?
0
9622
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10270
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10109
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10051
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6718
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2853
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.