LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-17-2014, 06:53 PM   #1
punt
Member
 
Registered: Jun 2001
Distribution: Fedora 22
Posts: 371

Rep: Reputation: 30
No permission to access databases no matter what I do


Okay, so I've spent a significant chunk of my day on this stressful situation.

The short version is I keep creating a username and password for MySQL (MariaDB) and I can't get in no matter what.

Here's an example of what I'm going through:

Code:
$ /sbin/service mysqld restart
Redirecting to /bin/systemctl restart  mysqld.service
$ mysql_setpermission -u user
Password for user user to connect to MySQL: 
Can't make a connection to the mysql server.
 The error: Access denied for user 'user'@'localhost' (using password: YES) at /usr/bin/mysql_setpermission line 90, <STDIN> line 1.
Here's the appropriate line in mysql.user:

Code:
| %         | user | *hashorsomethinghere | N           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          | N            | N          | N                     | N                | N            | N               | N                | N                | N              | N                   | N                  | N                | N          | N            | N                      |          |            |             |              |             0 |           0 |               0 |                    0 |        |                       | N                | N       |p
I can get in fine as the root user which has a password, but for some reason, everything I do with this other account fails with an error.

I've done every literal grant thing I could think of. Plus, I'm mostly using phpMyAdmin. I can't imagine why this is failing.

Code:
UPDATE `mysql`.`user` SET `Password` = PASSWORD('password') WHERE `user`.`Host` = '%' AND `user`.`User` = 'user'
Code:
GRANT ALL PRIVILEGES ON `database`.* TO 'user'@'%'WITH GRANT OPTION;
How do I find out exactly why this is failing?

Code:
$ mysql -u user -p database
Enter password: 
ERROR 1045 (28000): Access denied for user 'user'@'localhost' (using password: YES)

Last edited by punt; 12-20-2014 at 06:06 PM.
 
Old 12-18-2014, 10:40 AM   #2
vmccord
Member
 
Registered: Jun 2012
Location: Topeka, KS
Distribution: Mostly AWS
Posts: 71
Blog Entries: 31

Rep: Reputation: Disabled
If I recall correctly localhost is special. I always set that specifically. Also you have to have "identified by" in the grant option.


Code:
GRANT ALL PRIVILEGES ON `database`.* TO 'user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
 
Old 12-18-2014, 05:26 PM   #3
punt
Member
 
Registered: Jun 2001
Distribution: Fedora 22
Posts: 371

Original Poster
Rep: Reputation: 30
Thanks! Not sure why that fixed it, but it did
 
Old 12-18-2014, 08:35 PM   #4
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
Quote:
Originally Posted by punt View Post
Thanks! Not sure why that fixed it, but it did
well its very clear why it fixed your issue.. untill your card is enabled by the bank you wont be able to make transactions!! got it..?
 
Old 12-20-2014, 06:06 PM   #5
punt
Member
 
Registered: Jun 2001
Distribution: Fedora 22
Posts: 371

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by SAbhi View Post
well its very clear why it fixed your issue.. untill your card is enabled by the bank you wont be able to make transactions!! got it..?
Right, but ... I enabled the permissions in phpMyAdmin. Multiple times. So I'm not sure how phpMyAdmin *didn't* enable it.

I even copied the root user thinking something broke. But it didn't work.
 
Old 12-20-2014, 06:22 PM   #6
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by punt View Post
Right, but ... I enabled the permissions in phpMyAdmin. Multiple times. So I'm not sure how phpMyAdmin *didn't* enable it.

I even copied the root user thinking something broke. But it didn't work.
I don't think that you actually understand MySQL grants (i.e., user access permissions), including the root user grant, or phpmyadmin's relationship to MySQL.

And it is not at all clear from your description what permissions you thought you had set, and where.

Phpmyadmin can't enable anything unless the permissions exist in the the MySQL user permissions - i.e., via the GRANT.

I would suggest that you forget phpmyqdmin for the moment and study the MySQL manual for how grants work and how connections are established. Afterward read up on phpmyadmin for how it must be configured to interact with MySQL.

Last edited by astrogeek; 12-20-2014 at 06:28 PM.
 
Old 12-20-2014, 06:29 PM   #7
punt
Member
 
Registered: Jun 2001
Distribution: Fedora 22
Posts: 371

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by astrogeek View Post
I don't think that you actually understand MySQL grants (i.e., user access permissions), including the root user grant, or phpmyadmin's relationship to MySQL.

And it is not at all clear from your description what permissions you set, and where.

Phpmyadmin can't enable anything unless the permissions exist in the the MySQL user permissions - i.e., via the GRANT.

I would suggest that you forget phpmyqdmin for the moment and study the MySQL manual for how grants work and how connections are established. Afterward read up on phpmyadmin for how it must be configured to interact with MySQL.
Duly noted. I hate relying on software anyway and have always done it previously from the command line. I thought it'd be more robust after all these years and underestimated the command prompt. (I was also doing this as root.)

Thank you.
 
Old 12-20-2014, 06:33 PM   #8
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by punt View Post
Duly noted. I hate relying on software anyway and have always done it previously from the command line. I thought it'd be more robust after all these years and underestimated the command prompt. (I was also doing this as root.)

Thank you.
You are welcome.

It is easy to assume that the mysql root user is somehow special in the same sense that the system root user is - but it is not. "root" is just another MySQL user name and it has whatever permissions were granted to it.

And phpmyadmin is just another external application that must connect via some mysql user account, with only the permissions granted to that user - it has no special status either.

Good luck!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
i have given chmod 777 permission for access now how to revert that permission mohdsuboor23 Linux - Server 1 12-11-2010 05:19 AM
I can't get permission to edit wvdial.conf no matter what I try. Help please. XenaneX Ubuntu 5 03-16-2009 06:24 AM
how to open microsoft access databases in openoffice.org timothyr Linux - Software 1 11-23-2007 12:55 PM
Permission denied on /mnt/hdg1/test no matter what I do! jon_k Linux - Software 1 02-23-2006 06:21 PM
Linux and Microsoft Access Databases j0217995 Linux - General 7 03-04-2004 11:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration