views:

254

answers:

1
+1  Q: 

phpmyadmin bummer

Hey all people :-)

I think i did some nasty crap today...

I deleted the user (admin root) in phpmyadmin (XAMPP) now I can't create new users.

Any idea how to fix, or should I just try re-install the hole XAMPP packet :-/
I use Leopard iMac.

/Willy

+3  A: 

There is a method for resetting permissions in the MySQL manual. It deals with resetting the root password rather than recreating the root account, however I think you should be able to modify the method to re-insert the root account without any trouble.

Following the steps listed there (either method), if you change step 3 to insert a new account (fields might vary, this worked for my particular install):

INSERT INTO user VALUES('localhost','root',PASSWORD('some_pass'),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
FLUSH PRIVILEGES;

You should be able to take it from there and get the permissions back up to snuff.

zombat
Hey... error when adding the new user. ERROR 1227 (42000): Access denied; you need the RELOAD privilege for this operationTo RELOAD privilege I wrote that I had to be an super user/ admin :-/ any ideas ?
william
The mysql.user table has many columns dealing with privileges... for the root user they should probably all be set to 'Y'. I updated the query in my answer, try that one. If it's the FLUSH PRIVILEGES call that's causing the error, then I believe restarting the MySQL Server will have the same effect.
zombat
Maybe I do something wrong, I can't figueout. But seems like i get the same error again :S # 1mysql> INSERT INTO user VALUES('localhost','root',PASSWORD('pass'),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'); FLUSH PRIVILEGES;ERROR 1227 (42000): Access denied; you need the RELOAD privilege for this operation# 2 mysql> INSERT INTO user VALUES('localhost','root',PASSWORD(''),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');ERROR 1046 (3D000): No database selecteddoes anything rings for you ? :-)
william
Try starting your mysql session using `mysql -u root` instead of just `mysql`. There's a forum post here that describes the exact same process but it might be easier to follow: http://forums.fedoraforum.org/archive/index.php/t-168046.html
zombat
@zombat I really appreciate you help, Thank you very much. I will take a look at the link.
william