when the mysql database is installed in the linux OS, Why I can't connect the mysql database !

when the mysql database is installed in the linux OS,  Why I can't connect the mysql database
in the windowns OS using mysql ODBC 3.51 driver.
at the same,
the linux os 's IP is
the window os's IP is
whem I use the command “c:\mysql\bin\mysql -h -u root -p12345 mysql”
ERROR 2003: Can't connect to MySQL server on

thank you !
Who is Participating?
petoskey-001Connect With a Mentor Commented:

There are several things to check out.

1. Can PING  If not then your machines aren't able to connect and it's not MySql.  This proves your machines can talk.

2. Is MySql running on Linux?  Run "mysqladmin ping"  it should return "mysqld is alive".  This shows MySql is really running.

3. Can you telnet to port 3306 on the linux box from the linux box?  From the Linux shell prompt run "telnt localhost 3306".  If it works then the MySql server is listening on that port.  Try using the command line client on the Linux box and see if that works too.

4. Now we're sure MySql is running, can you telnet from to on port 3306?   Run "telnet" on the windows box.

5. If you can connect from Linux, but not from Windows, then chances are you have a firewall setup on Linux.  You need to check your ipTables setup.  Here's an article dealing with that a little bit.

try specifying the port too:
lmphpAuthor Commented:
don't work too.
thank you!

ERROR 2005: Unknown MySQL Server Host '
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

BTW to specify port using mysql client run...

c:\mysql\bin\mysql -h -u root -p12345 -P 3306

The is for telnet.
lmphpAuthor Commented:
1.I can ping it.
 2, the mysql is alive ,becuase i can use PHP to connect it.
3, I can't telnet in windows
4 i don't have firewall

thank you !
can you telnet into the linux box normally?

From windows "telnet"

You should be able to get a username/login prompt
lmphpAuthor Commented:
my linux OS don't open telnet service ,I think I can't telnet it in any way !
thank you !
it sounds to me like your Linux server is blocking outside connections, -or- you've setup mysql on some port other then 3306.  PHP works so I think you have a Linux firewall issue.

Try on Linux ...

"nmap localhost"


"iptables -L"

What distribution are you running for Linux?  You may be able to use a GUI tool to open up the port.
lmphpAuthor Commented:
when use nmap localhost
Port       State       Service
21/tcp     open        ftp                    
22/tcp     open        ssh                    
25/tcp     open        smtp                    
80/tcp     open        http                    
3306/tcp   open        mysql  

thank you ! I don't how to solve the problem ,But I need to solve it as soon as possiblie!
Mysql is running.  It works on the localhost.  The problem is no outside computer can connect to your Linux box.

Try "/etc/init.d/iptables status" on Linux.  That will tell you if you have a firewall running.

generally, it's a privilege problem. mysql default installation does not allow remote connections. so you must do :

GRANT ALL PRIVILEGES ON *.* TO 'remoteuser'@'%' IDENTIFIED BY 'remotepassword'

take a look at the GRANT syntax in mysql doc for details.
oh duh!

I hope that's right.  I've been building too many servers...
psadac, if it was a privs problem you would be looking at a different error:

ERROR 1045: Access denied for user: 'root@' (Using password: YES)

You WILL need to add the user though if you haven't done it already - also, don't forget to FLUSH PRIVILEGES after adding your remote user.


are you sure the IP is correct? should not be ?


lmphpAuthor Commented:
yes ,My Ip IS correct.
and I think I have enough rights to access the database ,because the mysql's table" user" have a
 host user password  Select_priv  
 %   root  12345       Y                  Y Y Y Y
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.