James wrote:
I had set up the following

I have a MYSQL server running on let's say 123.xx.xx.xx

User:  user1
Host:  111.xx.xx.xx

and gave that user the appropriate priveleges.

How exactly?  Did you use GRANT?  Something like

  GRANT ALL ON test.* TO [EMAIL PROTECTED] IDENTIFIED BY 'user1_pass';

or something else?

You can verify a user's privileges with SHOW GRANTS.  For example,

  SHOW GRANTS FOR [EMAIL PROTECTED];

So. I tried to connect to the MYSQL server from 111.xx.xx.xx using user1, but it won't allow me to.

How? Did you use the mysql client? What, precisely, was your command line? What does "it won't allow me to" mean? Did you get an error message? If so, what was it, exactly?

I then had to add this entry:

User: user1
Host:  %

One possibilty, then, is that mysql saw the connection as coming from a machine other than 111.xx.xx.xx, so the wild card worked where the specific IP did not. This should show up in the connection error message.

Now I'm allowed to access the MYSQL server. Doesn't % open it up to all clients wanting to connect? I want to restrict which machine can connect to the server. How do I do that?

Yes, [EMAIL PROTECTED] means user1 is allowed to connect from anywhere, so long as he/she supplies the correct password. Usually, you don't want that. If a wildcard is needed, you still try to restrict access as much as possible. For example, '[EMAIL PROTECTED]'.

Michael


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to