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
472 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
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Creating and Managing Databases with phpMyAdmin in cPanel.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

759 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now