Change MySQL port

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
tristanlee85
Forum Contributor
Posts: 172
Joined: Fri Dec 19, 2003 7:28 am

Change MySQL port

Post by tristanlee85 »

I'm trying to run MySQL on port 23 instead of 3306 due to blocked connections at work. I don't run a telnet server so port 23 is open, but whenever I change the port in my.cnf to port 23, I can't get the MySQL service to start. Is there any way around this?
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

Are you sure port 23 is free? You talk about mysql service so i assume you run it on windows. Run netstat in the console and see if there is no port 23 in the output.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Likely, something is bound to it.
Begby
Forum Regular
Posts: 575
Joined: Wed Dec 13, 2006 10:28 am

Post by Begby »

If you are on linux did you change the entry for that port in /etc/services? I think that might make a diff, but I am no linux expert.

Blocked how? If its blocked at the firewall and you are trying to get in through the outside, its blocked for a good reason. I don't think you want port 3306 just out there on the internets for all to see. You would be better off setting up a VPN or something of the sort.
tristanlee85
Forum Contributor
Posts: 172
Joined: Fri Dec 19, 2003 7:28 am

Post by tristanlee85 »

miro_igov wrote:Are you sure port 23 is free? You talk about mysql service so i assume you run it on windows. Run netstat in the console and see if there is no port 23 in the output.
I'm using Fedora Core 5. I ran 'netstat' in the terminal and didn't see anything using port 23.
tristanlee85
Forum Contributor
Posts: 172
Joined: Fri Dec 19, 2003 7:28 am

Post by tristanlee85 »

Begby wrote:If you are on linux did you change the entry for that port in /etc/services? I think that might make a diff, but I am no linux expert.
I changed it to mysql.

Code: Select all

ftp             21/tcp
ftp             21/udp          fsp fspd
ssh             22/tcp                          # SSH Remote Login Protocol
ssh             22/udp                          # SSH Remote Login Protocol
mysql           23/tcp
mysql           23/udp
Begby wrote:Blocked how? If its blocked at the firewall and you are trying to get in through the outside, its blocked for a good reason. I don't think you want port 3306 just out there on the internets for all to see. You would be better off setting up a VPN or something of the sort.
I run the MySQL server from my apartment. There isn't anything important on this server that will be of any use to anyone so accessing my SQL server from a remote location is the least of my security worries. I don't have the access blocked on my firewall. At work that must not allow outgoing connections to port 3306 because it times out, but if I change my program to connect to port 23, it will allow that.

Currently it works right now. I have the external port 23 re-route to internal port 3306 within my router configuration. That works just fine, but it's very slow due to the routing. That's why I would like to go directly to a SQL server running on port 23 instead of having to router an external port to an internal port. The reason I am choosing port 23 is because it works from work and it's a port that I'm not using here.
Post Reply