Re: Problem with GRANT ... 'user'@'%'

2007-05-22 Thread Mogens Melander
On my servers i'm using the 'user'@'localhost' for PHP apps.
running on the local web-server. Those users allocated for
web-apps can only connect to their specific DB from localhost.

On Tue, May 22, 2007 03:19, Miguel Cardenas wrote:
 Localhost is indeed a special value that isn't include in '%'. It's a
 feature not a bug ;)

 Regards,

 Bingo! That was the point! If i connect to the server ip or server name it
 works perfectly, but if I try to connect to localhost it fails unless I
 add a
 new user specific to localhost :D

 Thanks for your comments

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


 --
 This message has been scanned for viruses and
 dangerous content by OpenProtect(http://www.openprotect.com), and is
 believed to be clean.



-- 
Later

Mogens Melander
+45 40 85 71 38
+66 870 133 224



-- 
This message has been scanned for viruses and
dangerous content by OpenProtect(http://www.openprotect.com), and is
believed to be clean.


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



Re: Problem with GRANT ... 'user'@'%'

2007-05-21 Thread Miguel Cardenas
 If you don't specify a hostname in SHOW GRANTS, '%' is assumed.  My mistake
 for not telling you this before.  If you enable networking, and connect
 with

   mysql -h 127.0.0.1

 instead of

   mysql -h localhost

Well, in fact 127.0.0.1 and localhost produce the same effect but by using the 
ip address of the server works fine :D

Somebody has just sent a comment saying that localhost and a normal ip address 
work different, and in fact was right, now am able to connect to the ip 
instead of localhost...

Thanks for all your comments

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



Re: Problem with GRANT ... 'user'@'%'

2007-05-21 Thread Miguel Cardenas
 Localhost is indeed a special value that isn't include in '%'. It's a
 feature not a bug ;)

 Regards,

Bingo! That was the point! If i connect to the server ip or server name it 
works perfectly, but if I try to connect to localhost it fails unless I add a 
new user specific to localhost :D

Thanks for your comments

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



Re: Problem with GRANT ... 'user'@'%'

2007-05-21 Thread Miguel Cardenas
 Hm, I didn't know that!  I thought it was only a special value to the
 client tools, which I know will try to connect via socket on UNIX machines
 when they see 'localhost' but will try to connect via TCP/IP when they see
 '127.0.0.1'. Thanks for pointing this out!

 Baron

In fact that was the problem, connecting to localhost didn't work unless I add 
specifically localhost... If tried with the host ip or name worked perfectly, 
so your comment had sense and solved it all...

Just one comment, 127.0.0.1 had the same effect as localhost, I should connect 
to the specific host ip or name.

Thanks for all your comments

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



Re: Problem with GRANT ... 'user'@'%'

2007-05-20 Thread Mathieu Bruneau
Baron Schwartz a écrit :
 Hi,
 
 Miguel Cardenas wrote:
 Hello list

 I have a problem adding a user with host '%' ...

 *** If I add a user with host '%' when trying to connect get this error:
 ERROR 1045 (28000): Access denied for user 'myuser'@'localhost' (using
 password: YES)

 *** If I add the same user with localhost it connects and works fine...

 My specific doubt is:

 1) do I need to add a same user with both '%' and 'localhost' to
 connect locally and from another location???, or...

 2) for some reason a host '%' is not working or need to do something
 so it allows connections from any host?
 
 Remember to quote the user and host carefully.  So,
 
 GRANT ... TO 'user'@'%'
 
 not
 
 GRANT ... TO [EMAIL PROTECTED]
 
 If you have doubts about what you actually granted, do this:
 
 SHOW GRANTS FOR 'user'
 
 And see what host it claims the permissions are for.  If you did it
 wrong, it will say no such user exists.  If you do all this and
 everything looks okay, write back to the list again and maybe we can
 help you more.
 
 Oh, one more place to look is at the server configuration in /etc/my.cnf
 or equivalent, to be sure networking is configured right.  You want to
 check the bind-address and skip-networking settings.  You don't want
 skip-networking, and you want bind-address set to the machine's IP
 address.  Now that I think of it, this is more likely to be the problem
 for you.
 
 Cheers
 Baron
 


Localhost is indeed a special value that isn't include in '%'. It's a
feature not a bug ;)

Regards,

-- 
Mathieu Bruneau
aka ROunofF

===
GPG keys available @ http://rounoff.darktech.org

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



Re: Problem with GRANT ... 'user'@'%'

2007-05-20 Thread Baron Schwartz

Mathieu Bruneau wrote:

Baron Schwartz a écrit :

Hi,

Miguel Cardenas wrote:

Hello list

I have a problem adding a user with host '%' ...

*** If I add a user with host '%' when trying to connect get this error:
ERROR 1045 (28000): Access denied for user 'myuser'@'localhost' (using
password: YES)

*** If I add the same user with localhost it connects and works fine...

My specific doubt is:

1) do I need to add a same user with both '%' and 'localhost' to
connect locally and from another location???, or...

2) for some reason a host '%' is not working or need to do something
so it allows connections from any host?

Remember to quote the user and host carefully.  So,

GRANT ... TO 'user'@'%'

not

GRANT ... TO [EMAIL PROTECTED]

If you have doubts about what you actually granted, do this:

SHOW GRANTS FOR 'user'

And see what host it claims the permissions are for.  If you did it
wrong, it will say no such user exists.  If you do all this and
everything looks okay, write back to the list again and maybe we can
help you more.

Oh, one more place to look is at the server configuration in /etc/my.cnf
or equivalent, to be sure networking is configured right.  You want to
check the bind-address and skip-networking settings.  You don't want
skip-networking, and you want bind-address set to the machine's IP
address.  Now that I think of it, this is more likely to be the problem
for you.

Cheers
Baron




Localhost is indeed a special value that isn't include in '%'. It's a
feature not a bug ;)


Hm, I didn't know that!  I thought it was only a special value to the client 
tools, which I know will try to connect via socket on UNIX machines when they 
see 'localhost' but will try to connect via TCP/IP when they see '127.0.0.1'. 
Thanks for pointing this out!


Baron

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



Re: Problem with GRANT ... 'user'@'%'

2007-05-20 Thread Miguel Cardenas
 Remember to quote the user and host carefully.  So,

The quoting is okay, I tested again

 If you have doubts about what you actually granted, do this:
 SHOW GRANTS FOR 'user'

I've sent this command:
grant all on mydatabase.* to 'myuser'@'%' identified by 'mypass';

Then tested the show grants:
show grants for 'myuser';
---
Grants for [EMAIL PROTECTED] :
GRANT USAGE ON *.* TO 'myuser'@'%' IDENTIFIED BY PASSWORD '...'
GRANT ALL PRIVILEGES ON `mydatabase`.* TO 'myuser'@'%'

so it appears that user is added correctly, but when I try to connect get this 
error again:

ERROR 1045 (28000): Access denied for user 'myuser'@'localhost' (using 
password: YES)

 Oh, one more place to look is at the server configuration in /etc/my.cnf or
 equivalent, to be sure networking is configured right.  You want to check
 the bind-address and skip-networking settings.  You don't want
 skip-networking, and you want bind-address set to the machine's IP address.
  Now that I think of it, this is more likely to be the problem for you.

- skip-networking is disabled
- bind-address option is not present in /etc/my.cnf

should I try to add a:

bind-address = x.y.z.a

to the configuration file :-?


Thanks for any comment

**
P.S.
I've added the same user but using 'myuser'@'localhost' whithout deleting the 
first one created, and the new show grants outputs the *same* two lines of 
information

Grants for [EMAIL PROTECTED] :
GRANT USAGE ON *.* TO 'myuser'@'%' IDENTIFIED BY PASSWORD '...'
GRANT ALL PRIVILEGES ON `mydatabase`.* TO 'myuser'@'%'

but this time am able to connect. What can be wrong? or do I need to add 
both '%' and 'localhost' hosts?
**

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



Re: Problem with GRANT ... 'user'@'%'

2007-05-20 Thread Mogens Melander
You are still missing the GRANT for 'myuser'@'localhost'

On Mon, May 21, 2007 03:06, Miguel Cardenas wrote:
 Remember to quote the user and host carefully.  So,

 The quoting is okay, I tested again

 If you have doubts about what you actually granted, do this:
 SHOW GRANTS FOR 'user'

 I've sent this command:
 grant all on mydatabase.* to 'myuser'@'%' identified by 'mypass';

 Then tested the show grants:
 show grants for 'myuser';
 ---
 Grants for [EMAIL PROTECTED] :
 GRANT USAGE ON *.* TO 'myuser'@'%' IDENTIFIED BY PASSWORD '...'
 GRANT ALL PRIVILEGES ON `mydatabase`.* TO 'myuser'@'%'

 so it appears that user is added correctly, but when I try to connect get
 this
 error again:

 ERROR 1045 (28000): Access denied for user 'myuser'@'localhost' (using
 password: YES)

 Oh, one more place to look is at the server configuration in /etc/my.cnf
 or
 equivalent, to be sure networking is configured right.  You want to
 check
 the bind-address and skip-networking settings.  You don't want
 skip-networking, and you want bind-address set to the machine's IP
 address.
  Now that I think of it, this is more likely to be the problem for you.

 - skip-networking is disabled
 - bind-address option is not present in /etc/my.cnf

 should I try to add a:

 bind-address = x.y.z.a

 to the configuration file :-?


 Thanks for any comment

 **
 P.S.
 I've added the same user but using 'myuser'@'localhost' whithout deleting
 the
 first one created, and the new show grants outputs the *same* two lines of
 information

 Grants for [EMAIL PROTECTED] :
 GRANT USAGE ON *.* TO 'myuser'@'%' IDENTIFIED BY PASSWORD '...'
 GRANT ALL PRIVILEGES ON `mydatabase`.* TO 'myuser'@'%'

 but this time am able to connect. What can be wrong? or do I need to add
 both '%' and 'localhost' hosts?
 **

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


 --
 This message has been scanned for viruses and
 dangerous content by OpenProtect(http://www.openprotect.com), and is
 believed to be clean.



-- 
Later

Mogens Melander
+45 40 85 71 38
+66 870 133 224



-- 
This message has been scanned for viruses and
dangerous content by OpenProtect(http://www.openprotect.com), and is
believed to be clean.


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



Re: Problem with GRANT ... 'user'@'%'

2007-05-20 Thread Baron Schwartz

Hi,

Miguel Cardenas wrote:

Remember to quote the user and host carefully.  So,


The quoting is okay, I tested again


If you have doubts about what you actually granted, do this:
SHOW GRANTS FOR 'user'


I've sent this command:
grant all on mydatabase.* to 'myuser'@'%' identified by 'mypass';

Then tested the show grants:
show grants for 'myuser';
---
Grants for [EMAIL PROTECTED] :
GRANT USAGE ON *.* TO 'myuser'@'%' IDENTIFIED BY PASSWORD '...'
GRANT ALL PRIVILEGES ON `mydatabase`.* TO 'myuser'@'%'

so it appears that user is added correctly, but when I try to connect get this 
error again:


ERROR 1045 (28000): Access denied for user 'myuser'@'localhost' (using 
password: YES)



Oh, one more place to look is at the server configuration in /etc/my.cnf or
equivalent, to be sure networking is configured right.  You want to check
the bind-address and skip-networking settings.  You don't want
skip-networking, and you want bind-address set to the machine's IP address.
 Now that I think of it, this is more likely to be the problem for you.


- skip-networking is disabled
- bind-address option is not present in /etc/my.cnf

should I try to add a:

bind-address = x.y.z.a

to the configuration file :-?


Thanks for any comment

**
P.S.
I've added the same user but using 'myuser'@'localhost' whithout deleting the 
first one created, and the new show grants outputs the *same* two lines of 
information


Grants for [EMAIL PROTECTED] :
GRANT USAGE ON *.* TO 'myuser'@'%' IDENTIFIED BY PASSWORD '...'
GRANT ALL PRIVILEGES ON `mydatabase`.* TO 'myuser'@'%'

but this time am able to connect. What can be wrong? or do I need to add 
both '%' and 'localhost' hosts?

**



I think you now have two users, which you will only be able to see with these:

SHOW GRANTS FOR 'myuser'@'%'
SHOW GRANTS FOR 'myuser'@'localhost'

If you don't specify a hostname in SHOW GRANTS, '%' is assumed.  My mistake for 
not telling you this before.  If you enable networking, and connect with


mysql -h 127.0.0.1

instead of

mysql -h localhost

You will connect via TCP/IP, and you will be connecting as 'myuser'@'%' user. 
(As someone else said, localhost is a magical value with special behavior; it 
defaults to connecting via a socket on UNIX-ish systems, instead of TCP/IP). 
The simplest way to set this server configuration, if you haven't already, is 
probably to set bind-address to 127.0.0.1, which allows TCP/IP connections from 
the same machine.  If you want to be able to connect from elsewhere, set it to 
the server's IP address.


Cheers
Baron

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



Problem with GRANT ... 'user'@'%'

2007-05-19 Thread Miguel Cardenas
Hello list

I have a problem adding a user with host '%' ...

*** If I add a user with host '%' when trying to connect get this error:
ERROR 1045 (28000): Access denied for user 'myuser'@'localhost' (using 
password: YES)

*** If I add the same user with localhost it connects and works fine...

My specific doubt is:

1) do I need to add a same user with both '%' and 'localhost' to connect 
locally and from another location???, or...

2) for some reason a host '%' is not working or need to do something so it 
allows connections from any host?

Thanks for your help


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



Re: Problem with GRANT ... 'user'@'%'

2007-05-19 Thread Baron Schwartz

Hi,

Miguel Cardenas wrote:

Hello list

I have a problem adding a user with host '%' ...

*** If I add a user with host '%' when trying to connect get this error:
ERROR 1045 (28000): Access denied for user 'myuser'@'localhost' (using 
password: YES)


*** If I add the same user with localhost it connects and works fine...

My specific doubt is:

1) do I need to add a same user with both '%' and 'localhost' to connect 
locally and from another location???, or...


2) for some reason a host '%' is not working or need to do something so it 
allows connections from any host?


Remember to quote the user and host carefully.  So,

GRANT ... TO 'user'@'%'

not

GRANT ... TO [EMAIL PROTECTED]

If you have doubts about what you actually granted, do this:

SHOW GRANTS FOR 'user'

And see what host it claims the permissions are for.  If you did it wrong, it 
will say no such user exists.  If you do all this and everything looks okay, 
write back to the list again and maybe we can help you more.


Oh, one more place to look is at the server configuration in /etc/my.cnf or 
equivalent, to be sure networking is configured right.  You want to check the 
bind-address and skip-networking settings.  You don't want skip-networking, and 
you want bind-address set to the machine's IP address.  Now that I think of it, 
this is more likely to be the problem for you.


Cheers
Baron

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