visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Databases :: MySql :: Can't connect to mySQL server from Windows client


By: njava U.S.A.  Date: 17/09/2003 00:00:00  English  Points: 75 Status: Answered
Quality : Excellent
Hi all,

My mySQL server is hosted by ISP. I can connect to mySQL database just fine by using telnet and writing commands directly in UNIX prompt. I am also able connect to my database via PHP script.

It doesn't work when I use Windows clients, like mySQLFont or Mascon. I get this message: "Host 192.168.0.10 is not allowed to connect to this mySQL server".

I checked some resources on the Internet and newsgroups, and it turns out that there may be only two reasons for this error:

1. No database users with GRANT ALL permission
2. No additional hosts specified in some configuration file

I created users with GRANT ALL permission, so it's not that. I wasn't able to find detailed instructions on how to add hosts and to which file. There was a posting earlier in this forum with a similar problem but it explained how to replace localhost with 192.168.0.10 and this is not what I want. I want to be able to connect to the database from localhost and only specified hosts.

Here are my questions:

1. Which file (or table...what exactly) do I modify?
2. Where are they located in Linux? mySQL is installed into /usr/local/mysql/
3. What is the proper full syntax of the commands?
4. Is there an online reference to this? I checked <A HREF="http://www.mysql.com">www.mysql.com</a> thoroughly but this topic wasn't there or I might have still overlooked it.

Any help would be greatly appreciated. Many thanks!

By: bobbit31 Date: 17/09/2003 04:36:00 English  Type : Comment
GRANT ALL ON *.* TO winUser@* IDENTIFIED BY "winUserPassword"

the winUser@* might have to be winUser@%

but anyway, this will create a new user called winUser w/ password winUserPassword... use this information to connect to the db.
By: bobbit31 Date: 17/09/2003 04:36:00 English  Type : Comment
then, winUser will be able to access the db from any host.
By: bobbit31 Date: 17/09/2003 04:37:00 English  Type : Assist
oh and btw, you can also do winUser@192.168.0.10 which will allow winUser to only connect via that respective ip address
By: Squibi Date: 17/09/2003 17:00:00 English  Type : Assist
% is what you need, not *, and wrapping user and host in single quotes helps keep quirks away:

GRANT ALL ON *.* TO 'winUser'@'%' IDENTIFIED BY "winUserPassword"

By: njava Date: 17/09/2003 17:14:00 English  Type : Comment
Fantastic, the combination below worked:

GRANT ALL PRIVILEGES ON *.* TO users@192.168.0.10 IDENTIFIED BY 'testpass';

and I successfully connected to my database.

but

GRANT ALL PRIVILEGES ON *.* TO users@* IDENTIFIED BY 'testpass';

said that it was an error. It looks like mySQL doesn't like users@


By: Squibi Date: 17/09/2003 17:39:00 English  Type : Comment
Well, like I said, you would need %, not *. But the specific IP granting is more secure anyway.
By: VGR Date: 17/09/2003 17:54:00 English  Type : Answer
Squibi's right

you could also have done this :
<enter MySql console>
insert into mysql.user(Host,User,Password) values ('192.168.0.10','youruser',PASSWORD('yourpassword'));
flush privileges

it's more precise than the GRANT ALL stuff
By: bobbit31 Date: 17/09/2003 18:15:00 English  Type : Comment
btw, i ALSO said that you might have to use %:

< the winUser@* might have to be winUser@%
By: Squibi Date: 17/09/2003 18:17:00 English  Type : Comment
Oh I know, I was just clarifying which of the two you mentioned was the correct one.
By: njava Date: 17/09/2003 18:26:00 English  Type : Comment
I split the question points between the three of you. All your solutions led to the desired result and in all cases, after running those queries I connected to my database from my Windows client. It really made my day. Thanks so much!

Do register to be able to answer

EContact
browser fav
page generated in 314.569000 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page