How do I open port 3306 on my Ubuntu Linux Server....?

Experts:

I"m trying to access my MySQL database that is located on a remote Ubuntu Linux Server. I need to verify that Port 3306 is OPEN and LISTENING on this Linux Server.

I'm trying to access the Linux server using a Windows XP Pro workstation.

Please advise...thanks
M
LVL 17
MIKESoftware Solutions ConsultantAsked:
Who is Participating?
 
ZippitConnect With a Mentor Commented:
The netstat means that your server is not listening on the network.

You need to uncomment that "bind-address" line in your my.conf

(here's another reference)
http://markbrown.instantspot.com/blog/2007/03/30/Remote-Access-to-mySql-Database
0
 
albuitraCommented:
try from win xp with this
telnet IP_UBUNTU 3306
if the system shows something a black screen, so myql port is open
in this case, you have to create a user in mysql, and authorize to connect from xp
but if the response is something like could not open connection to host indicates that the firewall is active
in this case, you have to deactivate the rule that filter mysql
0
 
ZippitCommented:
you shouldn't have to open port 3306 explicitly unless you are running some kind of firewally.  more likely your MySQL server is not running, or is only listening on the local machine and not on the network.  Make sure the network section is uncommented in the mysql.conf file on your linux box (it is commented out by default).  The file should be here: (this is on Debian and MySql 5...so it may vary a little):

/etc/mysql/my.cnf

You'll also have to make sure the user you are trying to login as has rights to access to the db from the network.  Every user has a hostname associated with their name that determines where they are allowed to connect from.  Usually you want to keep it to 127.0.0.1, but some users will require network access, so it is usually set to the client IP they will be connecting from, or '%' to allow them to connect from any host.
0
Increase Security & Decrease Risk with NSPM Tools

Analyst firm, Enterprise Management Associates (EMA) reveals significant benefits to enterprises when using Network Security Policy Management (NSPM) solutions, while organizations without, experienced issues including non standard security policies and failed cloud migrations

 
MIKESoftware Solutions ConsultantAuthor Commented:
albuitra:

Ok..is said I could NOT open a connection to host: 3306, connection failed.

So, how do I DEACTIVATE the rule that filters MYSQL....???

Thanks
M
0
 
MIKESoftware Solutions ConsultantAuthor Commented:
Zippet:

MySQL is indeed running, and it is "listening" on port 3306.

I'm not sure if it is listening for NETWORK or not. So how do I UNCOMMENT the section in the file you mentioned? I'm only able to use the COMMAND PROMPT on this Linux Server.....

Also, how do I configure the USER rights...for MySQL?
0
 
albuitraCommented:
http://www.experts-exchange.com/OS/Linux/Administration/Q_23473692.html

From the prompt of Linux, try with this
telnet localhost 3306
So you can check if mysql is accepting connections from network

try with
iptables -L -n | grep 3306
0
 
ZippitCommented:
from the command prompt in the console type:

cat /etc/mysql/my.cnf | less

this will display the config file.  Typically near the top you'll see lines like the following:

[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

make sure they are uncommented (do not have # in front of them).

Also, look for a line (about 30 lines from the top) that looks like this:

bind-address            = 127.0.0.1

If you have this then MySQL is listening locally only and you will not be able to connect via the network.

Let me know what you find and we'll go from there.
0
 
ZippitCommented:
here's a good link, details some of the suggestions made in this thread and covers a few others:

http://dev.mysql.com/doc/refman/5.1/en/can-not-connect-to-server.html
0
 
MIKESoftware Solutions ConsultantAuthor Commented:
Zippet:

It has this on line 30:

#bind-address            = 127.0.0.1

Thx
M
0
 
MIKESoftware Solutions ConsultantAuthor Commented:
albuitra:

This:
telnet localhost 3306

Gave me This:
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
J
5.0.45-Debian_1ubuntu3.1-log¦1Ox/~NLq,uxyvds4IRA,WConnection closed by foreign host.

Your comments please?

Thanks
M
0
 
MIKESoftware Solutions ConsultantAuthor Commented:
albuitra:

This:
iptables -L -n | grep 3306

Gave me this:
WARNING: Error inserting x_tables (/lib/modules/<SOMEIPADDRESS>-server/kernel/net/netfilter/x_tables.ko): Operation not permitted
FATAL: Error inserting ip_tables (/lib/modules/<SOMEIPADDRESS>-server/kernel/net/ipv4/netfilter/ip_tables.ko): Operation not permitted
iptables v1.3.6: can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.

Comments please.
Thx
M
0
 
albuitraCommented:
Try with this
netstat  --protocol=inet  --all | grep 3306
If only shows 127.0.0.1:3306, then only allows connection from localhost
If shows *:3306, then mysql is accepting connections from network

Try the iptables command like root
0
 
MIKESoftware Solutions ConsultantAuthor Commented:
This:
netstat  --protocol=inet  --all | grep 3306

Did NOTHING...just when to next command line..nothing was displayed.

What do you mean by this:
"Try the iptables command like root"
0
 
albuitraCommented:
When you execute the command
iptables -L -n | grep 3306
Are you like a normal user or root ?
If you are like a normal user, please switch to root and then execute

try with
netstat --all | grep 3306
0
 
MIKESoftware Solutions ConsultantAuthor Commented:
How do I "switch to Root"..... very NEW to LINUX.
0
 
albuitraCommented:
su -
0
 
ZippitCommented:
oh...sorry...uncomment the "bind-address" and change the 127.0.0.1 to your server's IP

So it should be something like the following (assuming your server's IP is 192.168.32.101)

bind-address            = 192.168.32.101

you will need a text editor to do so.  VI can do it...but unless you know it I recommend going with something like joe or nano

if you don't have them then just run

sudo apt-get install joe
(assuming you have sudo access of course)

Once you fire up joe, use CTRL+K,H to see help for control keys.  But it's pretty straightforward.
0
 
ZippitCommented:
I really don't think it's his iptables if netstat is showing that 3306 isn't being listened on at all.  If it was iptables wouldn't netstat show the 3006 port?
0
 
MIKESoftware Solutions ConsultantAuthor Commented:
Whoooo hooo...ok I"m in ZIPPIT...thaks for the LINK..that was the best info I've seen on my error !

Thanks
M
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.