Locked my self out?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Locked my self out?

Postby joecrunk » 13. January 2010 05:28

Here is the problem:

Welcome to phpMyAdmin

Error

MySQL said: Documentation
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
Connection for controluser as defined in your configuration failed.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, user name and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

This my first time to ever set up any kind of server.It is just a test server I use to develop web pages. I have two CMS databases and a ton of info I don't wanna lose.

Where is the configuration file?

I clicked on a security measure and I had these red high lighted sections so I was clicking on things adding passwords and then boom,I am locked out.
It doesn't even give me a text box to put in the pass codes I just created.

I was trying to secure my site so I could run my server live,and access my work remotely.I was concerned about security and instead it's like I locked my keys in the car.Only problem is I don't have a brick to smash a window.
I really appreciate any help at all.Even a link to a description on this problem would be great.
Thanks
joecrunk
 
Posts: 13
Joined: 13. January 2010 05:10
Location: Bellville TX, USA

Re: Locked my self out?

Postby Izzy » 13. January 2010 07:09

Try this:

Delete any cookies you find for localhost or phpmyadmin etc. in your browser.

Try and return all files that your edited back to their original state.

Go to http://localhost and select the Security item and follow the link to set your passwords.

\xampp\readme_en.txt file under section:
A matter of security (A MUST READ!)

Where is the configuration file?
The configuration file mentioned in the error message is the \xampp\phpMyAdmin\config.inc.php file - but this may not need editing if the above method works for you - let me know back please.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Locked my self out?

Postby joecrunk » 13. January 2010 12:45

Wow,thank you a ton. I finally got back in. Still a slight issue though.
I could not log in as admin,or my handle,joecrunk.
Each database has it's own user with full privileges.
For example, Word Press is Wordpress_user and Drupal is Drupal_user.
So in my drop down menu,in my sign in at my php screen,I tried logging in as "admin",no such luck,then the user name "joecrunk" no luck there either.
It is telling me my password is incorrect,even though I just put it in at the other screen and had it successfully changed.

Finally I said what the heck and tried another user and I am on with a user with admin privileges, just not as my actual admin.
I need my admin so when I limit my priviledges per user I can let clients log on and check out there work before going "live".
I am still jacking with it and will post back if I get it fixed,any suggestions are welcomed.
Thanks again for the help.
joecrunk
 
Posts: 13
Joined: 13. January 2010 05:10
Location: Bellville TX, USA

Re: Locked my self out?

Postby joecrunk » 14. January 2010 00:18

After reading quit a bit I feel I know enough to be dangerous.I am still having the same issue with not being able to log in as admin.
Now I was reading through an article that said there were basically two options.
1. go to the security page(like I first did) and make adjustments there.
2.I can go into the shell and access it there on the command prompt,and then rewrite the pass word in my \config.inc.php.
So maybe this is not as simple as I first thought.
Here is the link to the article I was reading.
http://www.apachefriends.org/en/faq-xampp-windows.html#password2
My entire problem started with the fact I want to access my server from anywhere.Like a remote server so I can work from anywhere and keep it on my computer. I can't find a definitive article on how to do that either,and I am still concerned about security.
So,I still have not gotten the conclusion I am after,which is a admin "superuser" so I can scale back other user privileges.
My next step,is to attempt the shell password change and rewrite the file as well.
Any ideas or links would really be appreciated.I am having a hard time finding specific enough articles on this,which tells me when I get through it,I need to write one.
Maybe my skill level is the real problem.Not sure But Thank you for any help or links to resources on this subject
joecrunk
 
Posts: 13
Joined: 13. January 2010 05:10
Location: Bellville TX, USA

Re: Locked my self out?

Postby joecrunk » 14. January 2010 01:20

I created a new user,named admin with all privileges.
Admin can access both of my data bases.
Now I need to figure out what "root" user is exactly and "PMA" as well.
I deleted both pma and root and now at the bottom I have this:

Connection for controluser as defined in your configuration failed.

No clue what that means.
I can't get into my drupal db anymore,but I log into wordpress db no problem.

I am going to stop jacking with stuff now.

I am trying to put up the play by play on here, so feel free at any minute to jump in.

Or break my hands with a tire iron so I will stop screwing things up lol.
joecrunk
 
Posts: 13
Joined: 13. January 2010 05:10
Location: Bellville TX, USA

Re: Locked my self out?

Postby Izzy » 14. January 2010 01:26

Let's go back to the defaults that were in place after you installed XAMPP - you did make backups of the files you edited?

Remove any edits you made in the config.inc.php file.


How I can set a "root" password in MySQL? (method 1) from your FAQ link.
Forget method 2 because you are going to the use simple easy method 1.

Next go to the Security page in http://localhost

Click on the link:
http://localhost/security/xamppsecurity.php <= [allowed only for localhost]

Next add your password for MySQL SuperUser: root
(If you have set this already then just add the password you had already entered previous - after accepting the password you should get back this message:
The root password was successfully changed. Please restart MYSQL to enable these changes!
).

Next Select phpMyAdmin authentication: cookie

Next Set a random password for the phpMyAdmin user 'pma': No

For security don't tick this box if you can always remember your root password.
(File: C:\xampp5\security\mysqlrootpasswd.txt)

Finally click on the Password changing) button and your done with this page.
(You can return if you want to secure your xampp folder).


Now login to phpMyAdmin and accept cookies from now on from this page.

You are now the super user root and have access to all things phpMyAdmin.

The root user can only access phpMyAdmin from the localhost PC - the one XAMPP is installed on as set in the Privileges menu - this can be changed as outlined below for admin but best leave as it is.

If you want to create a user admin that can access from outside the localhost PC (remote access) then create this user by clicking on Privileges button.

Click on Add a new User.

Login Information:
User name: admin
Host: type % in the box.
Password: your choice of admin password here
Retype : repeat the above password

Click on Check All under Global privileges.

Click on Go.

Now you have a user admin that can do all things root can but from a remote location or localhost.

Click on Log out from phpMyAdmin main page and login again with user admin and the password you created for admin - if you can try from the remote location for testing.


When you created your database with a user and a password for that user then you should be able to login to phpMyAdmin using the database username and the password for that database user.

This database user will only be able to see and manipulate the database for that user - and any databases set for any user like information_schema.

Make sure that any database you want to have access from other than localhost (your PC) has the host set to any host - the % symbol - for that database user as defined in the Privileges tab.


Please post back when you get this far and give any issues that may arise with this as if you can follow the above then you will be able to do what you want.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Locked my self out?

Postby joecrunk » 14. January 2010 02:03

I follow along until I get to enter old password
which I do.
then when I enter a new password, I get a drop down menu that wants me to pick which user.
I tried "admin"
went back to the php myadmin and got this:
#1045 - Access denied for user 'root'@'localhost' (using password: YES)

on the top box and this at the bottom:

Connection for controluser as defined in your configuration failed.
joecrunk
 
Posts: 13
Joined: 13. January 2010 05:10
Location: Bellville TX, USA

Re: Locked my self out?

Postby joecrunk » 14. January 2010 02:08

Stopped my apache and sql in my control panel,restatred and now my old pass word worked.
still working on the rest.
joecrunk
 
Posts: 13
Joined: 13. January 2010 05:10
Location: Bellville TX, USA

Re: Locked my self out?

Postby Izzy » 14. January 2010 02:10

If it happens again and you can't access with root user at all then run the \xampp\mysql\resetroot.bat file to clear the root users password from everywhere.

Then go to the Security page again and set the root users password.

First after clearing the password using the bat file try and login to phpMyAdmin with user root and no password as you have removed it, then follow the instructions to create a password for root again and restart MySQL and try login again.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Locked my self out?

Postby joecrunk » 14. January 2010 02:22

Everything is working.
I still have this error under privileges:

Connection for controluser as defined in your configuration failed.

I have not been able to test remotely yet,but I think I understand the concept and what privileges need to be set.
More importantly, I can access the work I needed to get to on my system right in front of me.
Does this error matter?


Clearly I need more research and less development right now.

Thank you so much for your help.
joecrunk
 
Posts: 13
Joined: 13. January 2010 05:10
Location: Bellville TX, USA

Re: Locked my self out?

Postby Izzy » 14. January 2010 02:46

joecrunk wrote:Connection for controluser as defined in your configuration failed.
The control user is pma and you can set the password in the Privileges menu by selecting the pma user and then the little icon at the end of the line.
(In older phpMyAdmin versions the pma user had no password to prevent errors when trying to close phpMyAdmin and appears to have been reviewed in newer versions to now require a password).

Don't select any Global privileges!

Go down to Change password.

Click Generate a password - it will be entered in the correct boxes for you.

Copy that password from the Generate box to your clip board.

Then click on Go in the same Change password section.

Next open config.inc.php then paste it into the controluser pma password field.
Code: Select all
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'paste the password in here';
Save the file.

Log out of phpMyAdmin.

Restart MySQL.

Log in with root again and the message should be gone.

The pma user has very limited privileges and mainly is for shutting down phpMyAdmin.

TIP
Joe wrote:I am still jacking with it
This method can be a great deal of fun and frustrating at times, but it can also aid greatly with learning what makes things tick

For it to be most effective it is always best practice to be able to start over from the beginning with a clean fresh start - always make a back up Copy of any files that you intend to "jack" with first so, in effect, you create this needed fresh starting point by deleting the "jacked" file and then simply renaming the Copy of file so you can perhaps easily take a different tack on the issues.

Good luck and I bet you know a great deal more now about what makes this phpMyAdmin tick. :D
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Locked my self out?

Postby joecrunk » 14. January 2010 05:31

Okay here is the latest and greatest error I am receiving:

SQL query: DocumentationEdit

INSERT INTO `phpmyadmin`.`pma_history` (
`username` ,
`db` ,
`table` ,
`timevalue` ,
`sqlquery`
)
VALUES (
'admin', '', '', NOW( ) , 'SELECT *, IF(`Password` = _latin1 '''', ''N'', ''Y'') AS ''Password'' FROM `mysql`.`user` ORDER BY `User` ASC, `Host` ASC;'
)

MySQL said: Documentation
#1142 - INSERT command denied to user 'pma'@'localhost' for table 'pma_history'

I deleted PMA and Root earlier.
So I created a new PMA user, never touched any global privileges,edited my config.php file and now I have this error.
I also stopped and started my server .This error was after the fact
joecrunk
 
Posts: 13
Joined: 13. January 2010 05:10
Location: Bellville TX, USA

Re: Locked my self out?

Postby Izzy » 14. January 2010 05:58

joecrunk wrote:I deleted PMA and Root earlier.
Joe, these are the 2 users that should never be deleted, as you have just found out. ;)

The pma user is the control user for phpMyAdmin functions.

I know you created an almost identical admin user but only use admin when accessing from a remote location and use root when at your localhost PC.



Go to Privileges and select the user pma edit button.

Scroll down to Database-specific privileges.

Select database phpmyadmin from the drop box.

From the next screen that appears, which shows:
Edit Privileges: User 'pma'@'localhost' - Database phpmyadmin
Database-specific privileges
tick only SELECT, INSERT, UPDATE, DELETE in the Data section.

Click on Go

Check that the pma password is still intact in the config.inc.php file.

You may have to enter it again in Privileges but not sure, so check that out and correct again using the previous posts.

That should fix the pma user and remove the error message.



Create the root user in the same way as you created your admin user only select host: localhost instead of any host: %

Select no password.

Then try and log in with root and no password.

Go to security and create your root user password again mentioned in previous post if required.

That should fix the root user.

Joe, please let me know how you get on.
Thanks.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Locked my self out?

Postby joecrunk » 14. January 2010 07:53

Brilliant.
Absolutely brilliant.
Worked like a charm.
I had almost lost hope.
What did you do, create the entire server idea from scratch yourself? You are a resource of knowledge.
I really thought I was going to have to back up my stuff and delete everything. It is so much better you found a solution because I learned a ton in this process.

Like NEVER delete those two users because as it turns out,they are important.
I should be flogged for stupidity. Goes to show,look before you leap.

I logged in as root,no password, all errors gone.
Set up pma with specific privileges as noted.Gave root all options(super user to all things php myadmin)

You should write a book, seriously.I would buy it.
Thank you so much

Take it easy,
Joe
joecrunk
 
Posts: 13
Joined: 13. January 2010 05:10
Location: Bellville TX, USA


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 119 guests