Link to home
Start Free TrialLog in
Avatar of lmphp
lmphp

asked on

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 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 !
Avatar of Nick_72
Nick_72

try specifying the port too:

168.192.0.1:3306
Avatar of lmphp

ASKER

don't work too.
thank you!

ERROR 2005: Unknown MySQL Server Host '168.192.0.1:3306(11001)
ASKER CERTIFIED SOLUTION
Avatar of petoskey-001
petoskey-001

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of lmphp

ASKER

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 !
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
Avatar of lmphp

ASKER

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"

and

"iptables -L"

What distribution are you running for Linux?  You may be able to use a GUI tool to open up the port.
Avatar of lmphp

ASKER

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@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


Avatar of lmphp

ASKER

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