Bug 145284 - mysql client can't connect with specified user
mysql client can't connect with specified user
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: mysql (Show other bugs)
3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tom Lane
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-01-16 18:20 EST by Jack Neely
Modified: 2013-07-02 23:03 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-01-20 15:08:38 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jack Neely 2005-01-16 18:20:54 EST
Description of problem:
If I specify a user to connect as on the mysql command line I am
unable to connect to the database.

[root@narsil current]# mysql -u current -D current
ERROR 1044: Access denied for user: '@localhost' to database 'current'

However, this works

root@narsil current]# mysql current -D current

This wouldn't bother me, but it looks like the python bindings are
hitting the same issue:

>>> con =  MySQLdb.connect(user="current", db="current")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.3/site-packages/MySQLdb/__init__.py", line
63, in Connect
    return apply(Connection, args, kwargs)
  File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line
115, in __init__
    self._make_connection(args, kwargs2)
  File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line
41, in _make_connection
    apply(super(ConnectionBase, self).__init__, args, kwargs)
_mysql_exceptions.OperationalError: (1044, "Access denied for user:
'@localhost' to database 'current'")

To work around the bug here I have just given rights to what would be
mysql's default user to log in as.  (In this case apache.)

What's up with user "@localhost"?

Version-Release number of selected component (if applicable):
mysql-3.23.58-14
Comment 1 Jack Neely 2005-01-16 18:38:48 EST
I lied.  Giving rights to apache with:

   GRANT ALL PRIVILEGES  on current.* to 'apache'@'localhost' ;

Doesn't work.  The only way I could get the user apache permission to
the current db is to do

   GRANT ALL PRIVILEGES  on *.* to 'apache'@'localhost' ;

which granted apache all rights everywhere instead.
Comment 2 Tom Lane 2005-01-16 20:56:20 EST
I think it's working as designed.  It looks like you haven't created a
local mysql user named 'current', so in the first case the connection
instead references the default anonymous-user account (named
'@localhost'), which evidently doesn't have permissions to access the
database named 'current'.  The second example is a redundant
specification of the database name 'current', and the user name falls
back to your Unix account name, which evidently does correspond to a
mysql user with sufficient permissions to connect.  See the mysql
manual's chapter on user account management.

I don't much care for mysql's approach to managing users and
privileges, but Red Hat's certainly not going to undertake redesigning
it.  You could file a bug at www.mysql.com if you think you have
arguments that will persuade them to change their design.
Comment 3 Jack Neely 2005-01-20 15:08:38 EST
I don't much care for mysql either.  It looks like I didn't give the
user enough permissions to see if it had permissions to the specific
database or some such like that.

Closing bug...will poke around their bugzilla.

Note You need to log in before you can comment on or make changes to this bug.