PDA

View Full Version : Request: Support for MySQL Port


Malaphus
06-06-2002, 04:52 AM
I would like to be able to specify the port my MySQL server is running on, in the db.ini file. Currently my MySQL server is running on a linux box on a port other than the default MySQL port so I am unable to use world.exe.

bot403
06-06-2002, 09:32 AM
You could use iptables on the database machine and create a rule that would redirect all pakcets from the standard port to the one you are running on.

Malaphus
06-06-2002, 11:44 PM
The database machine is owned by a hosting provider. I can't make any system changes like that.

Trumpcard
06-06-2002, 11:59 PM
Haven't looked into it, but if it's using the standard Mysql C++ API, there are several connection methods available.. Probably just need to switch to one that includes the port when making the initial connection then read it out of the env file.


public Connection (const char *db, const char *host = "", const char *user = "", const char *passwd = "", bool te = true)

public Connection (const char *db, const char *host, const char *user, const char *passwd, uint port, my_bool compress = 1, unsigned int connect_timeout = 5, bool te = true, cchar *socket_name = "")

bot403
06-07-2002, 01:05 AM
If im right, this might not be possible, but by some chance it might be because i havent loked into it. Use iptables on your eqemu machine to mangle packets with the DNAT option and redirect it to their port. SOmething like

iptables -t nat -A PREROUTING -p tcp --sport 9000 --dport 2326 -j DNAT --to-destination 10.10.10.10:2327

im not sure what the mysql port is so i just faked it and used 2326, that should be replaced with the mysql port.

Basically all packets coming from port 9000 and trying to goto the mysql port on their computer will get re-written beore they leave your machine to go to your hosts computer on the new port.

That line probably wont work, but i think it illustrates the comcept.