Solved

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

Posted on 2004-10-04
14
479 Views
Last Modified: 2012-06-27
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 168.192.0.1
the window os's IP is 168.192.0.2
whem I use the command “c:\mysql\bin\mysql -h 168.192.0.1 -u root -p12345 mysql”
ERROR 2003: Can't connect to MySQL server on 168.198.0.1(10054)

thank you !
0
Comment
Question by:lmphp
14 Comments
 
LVL 9

Expert Comment

by:Nick_72
ID: 12216490
try specifying the port too:

168.192.0.1:3306
0
 
LVL 1

Author Comment

by:lmphp
ID: 12216596
don't work too.
thank you!

ERROR 2005: Unknown MySQL Server Host '168.192.0.1:3306(11001)
0
 
LVL 7

Accepted Solution

by:
petoskey-001 earned 500 total points
ID: 12216618

There are several things to check out.

1. Can 192.168.0.2 PING 192.168.0.1?  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 192.168.0.2 to 192.168.0.1 on port 3306?   Run "telnet 192.168.0.1:3306" 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.
http://www.linuxforum.com/forums/index.php?showtopic=95858

0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 7

Expert Comment

by:petoskey-001
ID: 12216647
BTW to specify port using mysql client run...

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

The 192.168.0.1:3306 is for telnet.
0
 
LVL 1

Author Comment

by:lmphp
ID: 12216817
1.I can ping it.
 2, the mysql is alive ,becuase i can use PHP to connect it.
3, I can't telnet 192.168.0.1:3306 in windows
4 i don't have firewall

thank you !
0
 
LVL 7

Expert Comment

by:petoskey-001
ID: 12216837
can you telnet into the linux box normally?

From windows "telnet 192.168.0.1"

You should be able to get a username/login prompt
0
 
LVL 1

Author Comment

by:lmphp
ID: 12217011
my linux OS don't open telnet service ,I think I can't telnet it in any way !
thank you !
0
 
LVL 7

Expert Comment

by:petoskey-001
ID: 12217145
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"

and

"iptables -L"

What distribution are you running for Linux?  You may be able to use a GUI tool to open up the port.
0
 
LVL 1

Author Comment

by:lmphp
ID: 12217216
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!
0
 
LVL 7

Expert Comment

by:petoskey-001
ID: 12217254
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.

0
 
LVL 14

Expert Comment

by:psadac
ID: 12217483
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.
0
 
LVL 7

Expert Comment

by:petoskey-001
ID: 12217490
oh duh!

I hope that's right.  I've been building too many servers...
0
 
LVL 10

Expert Comment

by:frugle
ID: 12221632
psadac, if it was a privs problem you would be looking at a different error:

ERROR 1045: Access denied for user: 'root@192.168.0.2' (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.

STUPID QUESTION.....

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

Mike


0
 
LVL 1

Author Comment

by:lmphp
ID: 12223581
yes ,My Ip IS correct.
and I think I have enough rights to access the database ,because the mysql's table" user" have a
recorder
 host user password  Select_priv  
 %   root  12345       Y                  Y Y Y Y
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question