Newbie problem with GRANT statement

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm sure there's some obvious answer, but why doesn't this work:

mysql> grant all on *.* to mailman@localhost identified by 'bar';
Query OK, 0 rows affected (0.04 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)


[xxx@localhost cgi-bin]$ mysql -u mailman/bar
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19 to server version: 4.1.8-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use genes;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database

If I granted ALL on everything, how can I not be able to use a database???

same result if I 'grant all on genes.*'

same result if I create a user 'foo' who is not in /etc/passwd

Re: Newbie problem with GRANT statement

no spam wrote:
Quoted text here. Click to load it

You specified a password.  That means that you must give that password
when you log in as that user name.  MySQL will not prompt you for a
password unless you use the -p option, because creating a user name
_without_ a password is also supported in MySQL.

To use the -p option:

   mysql -u mailman -pbar

(note the lack of a space between -p and bar -- it's important)

You can also omit the password string, and mysql will prompt you for it.
  This is recommended in a multi-user environment, because people could
use `ps' to see your command-line arguments.

   mysql -u mailman -p

Quoted text here. Click to load it

For what it's worth, the MySQL user names have nothing to do with
/etc/passwd.  You can make MySQL user names that are the same as those
in /etc/passwd, and they can even have different passwords than their
counterparts in /etc/passwd.  Also note that if your MySQL user name is
the same as one in /etc/passwd, and you change the password for one or
the other, that password change doesn't apply to the other.

Bill K.

Site Timeline