LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-13-2011, 04:23 PM   #1
wabby
LQ Newbie
 
Registered: Feb 2011
Posts: 6

Rep: Reputation: 0
[MySQL] - Root lost grant privileges - SOLVED


Hello,

for some reason root lost grant privileges and I can't get it back.

The user got grant_priv = 'Y' in the usertable.
I've tried to reset all the priviliges to the user by killing MySQL process and started up again without grant options with no luck.

I've also tried lots of other things but can't seem to get it work. Here is what I get:

Quote:

[root@xxxxxxxxx mysqldba]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.77 Source distribution

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

mysql> GRANT ALL PRIVILEGES ON *.* TO 'dev'@'localhost';
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I've tried so many different things now that I'm all out of ideas

Last edited by wabby; 02-15-2011 at 02:44 PM.
 
Old 02-13-2011, 05:35 PM   #2
tenmei08
LQ Newbie
 
Registered: Jan 2011
Location: Roatan Honduras
Distribution: Debian Lenny, Squeeze, Ubuntu Various
Posts: 13

Rep: Reputation: 5
Restoring Root in MySql

Initially, try logging in as root and executing the following:
Quote:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost';
FLUSH PRIVILEGES;
(In the code you quoted you tried granting ALL PRIVILEGES to 'dev'@'localhost'.)

If this won't work and the user account has grant privileges, try logging in as the user and running the same instructions above.
Fix root, then tackle correcting the user account.

Last edited by tenmei08; 02-13-2011 at 05:36 PM.
 
Old 02-13-2011, 05:44 PM   #3
wabby
LQ Newbie
 
Registered: Feb 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by tenmei08 View Post
Initially, try logging in as root and executing the following:


(In the code you quoted you tried granting ALL PRIVILEGES to 'dev'@'localhost'.)

If this won't work and the user account has grant privileges, try logging in as the user and running the same instructions above.
Fix root, then tackle correcting the user account.
Hi,
I know i tried to grant to 'dev' user. Thats because the root user should be abel to.

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost';
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Problem is as you stated the root user. Everything also looks ok mysql.user table.
No users is abel to grant, even when everything looks ok. It's like the mysql server ignores FLUSH, and restart of Mysqld.
 
Old 02-13-2011, 06:41 PM   #4
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
What does the following command show you:

Code:
mysql> show grants;
Regards,

Fordeck
 
Old 02-14-2011, 01:32 AM   #5
wabby
LQ Newbie
 
Registered: Feb 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by fordeck View Post
What does the following command show you:

Code:
mysql> show grants;
Regards,

Fordeck
The wierdes thing.....


Quote:

Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.0.77 Source distribution

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

mysql> show grants;
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SUPER ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD 'xxxxxxxxxxxxx' WITH GRANT OPTION |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'dev'@'localhost';
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
mysql>




 
Old 02-15-2011, 02:20 AM   #6
wabby
LQ Newbie
 
Registered: Feb 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Hummm, getting out of ideas now :S Going to order a reboot on that box now.
Any ideas?
 
Old 02-15-2011, 08:29 AM   #7
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
So do you have complete root/administrative control of the machine? Given your last post it is not clear

Quote:
Originally Posted by wabby View Post
Hummm, getting out of ideas now :S Going to order a reboot on that box now.
Any ideas?
If you have complete root access you could always try restoring the corrupt grant tables from a backup. Or create a fresh one.

Is MySQL running on a windows or a linux platform?

On linux I believe you can create a fresh grant table using mysql_install_db. However you should be aware that if the user table has to be created, this will re-create the mysql database which includes your users (i.e. root ...) so root would end up with a blank password and other users would need to be re-created.

mysql_install_db may not be in your system path but is usually found in the scripts directory under the MySQL install directory.

Anyway you may want to look into mysql_install_db as it may take care of your problem.

Regards,

Fordeck
 
Old 02-15-2011, 02:44 PM   #8
wabby
LQ Newbie
 
Registered: Feb 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Hello,

thanks for your reply. I have root access, but I need to announce restart on a server that is used by all developers.
But we found the problem. When this machine was installed up (virtual OS - Centos) it was in a network with a very restricted firewall.
During the MySQL installations it does a internal lookup that failed. For some reason that screwed up the whole installation and made alot of wierd error.

So the solution was actually a re-install of MySQL, luckily this is a developer box, so restoring all the databases from live didnt take long. But I wanted to try to figure out and fix the problem without reinstall just in case if a similar problem would occur in the future on a live box.

Anyway, thanks for the replies.
 
  


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
Grant Privileges - MySQL Jannyno Linux - General 2 06-23-2012 02:00 AM
How secure to grant "reload" privileges to a normal user in MySql deepakdeore2004 Linux - Security 2 10-20-2010 08:42 AM
[SOLVED] MySQL: Can't GRANT privileges after restoring a database Chili.Willy Linux - Software 2 12-03-2009 09:21 PM
Grant Configuring SUDO Root Privileges to Regular Users +Problem+ redir Fedora 2 02-26-2007 11:10 AM
Grant a user root privileges to add and delete users Maranza Linux - Security 6 11-02-2006 10:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:47 AM.

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