?
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
Medium Priority
?
487 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 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