MySQL on Linux 12.04 VPS and MySQL Workbench Communication

koeks525

Executive Member
Joined
Jul 14, 2012
Messages
6,018
Reaction score
1,202
Location
Canada
Hi everyone,

I installed MySQL Server on my Linux VPS Server, which runs Ubuntu Server 12.04. I have set the root password for MySQL.

I want to work with my MySQL Server, but through MySQL Workbench which I have installed on my main laptop. I want to open port 8080 (so I can work at home and at varsity - port 3306 seems to be blocked on campus). How does one open the port on Linux Ubuntu?

Thanks.
 
You will need to change the default port for MySQL. Edit my.cnf and change the port to 8080.

I wouldnt pick this port though - its a well known port on the internet and you will get lots of port scans on that port.
Also not the most secure option opening MySQL port to the internet. Can't you VPN in?
 
You will need to change the default port for MySQL. Edit my.cnf and change the port to 8080.

I wouldnt pick this port though - its a well known port on the internet and you will get lots of port scans on that port.
Also not the most secure option opening MySQL port to the internet. Can't you VPN in?

If I were to VPN it, that would mean I would need to setup a VPN Server on the Linux VPS Server?

Another random question, if you need to create an application that is to use tables on the mysql server, can you control which ports to use?
 
Yes - you would need to configure VPN on the server. (And hopefully the campus allow incoming VPN's)

You mean if you change the default port of the sql server? On the app you are writing you would then need specify the port so that the default is not used. I can't think of any language that doesn't allow you to do this.
 
No need to change the MySQL port.

I presume the varsity has a static IP? Just add a rule on your router to allow 3306 from varsity to your MySQL server. Also remember to allow remote connections to your MySQL server with a user usage on the desired database. Do not login as root.

Also maybe rather look at Percona MySQL as to normal MySQL

Percona Server Feature Comparison

This is what I do to install a new instance of a MySQL server. I do not install LAMP, I just do a clean install.

Code:
$ apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A

Add this to /etc/apt/sources.list, replacing VERSION with the name of your distribution:

Code:
deb http://repo.percona.com/apt VERSION main
deb-src http://repo.percona.com/apt VERSION main

Remember to update the local cache:

Code:
$ apt-get update

After that you can install the server and client packages

Code:
$ apt-get install percona-server-server-5.6 percona-server-client-5.6 xtrabackup sshfs
 
Easiest would be to redirect requests to 8080 using iptables on the server.

"iptables -t nat -A PREROUTING -i eth0 -p tcp --dport $srcPortNumber -j REDIRECT --to-port $dstPortNumber"

"iptables -t nat -A PREROUTING -i eth0 -p tcp --dport8080 -j REDIRECT --to-port 3306"

On the client you would have to specify the non-default port in your connection string.
 
Top
Sign up to the MyBroadband newsletter
X