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
481 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mySql Syntax 7 55
SQL inner join confusion 15 55
Trigger usage 2 75
PHP insert data in to database... this is not letting me in insert data...please help! 7 57
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

860 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