Page 1 of 2

Forgot password

PostPosted: 21. October 2010 19:15
by spanner
Please help me.

I forgot the Mysql database Admin username & password. (I changed the default root & added a password after install).

I have searched high and low, but I can't figure out how to reset the username and password. (Mysql Admin)

I have accessed the config.inc (script) and config.inc.php files in xampp>phpMyAdmin folder and they both say user is root and password is empty like this

Code: Select all
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type']            = 'config';
$cfg['Servers'][$i]['user']                 = 'root';
$cfg['Servers'][$i]['password']             = '';
$cfg['Servers'][$i]['AllowNoPassword']      = true;


I can access the apache xampp admin panel and the security page but I can't remember the username or password for the Mysql database and I can't get in.

What do I need to do to reset them?

I tried changing the config.inc but it doesn't work.

How can I fix it?

Do I need to re-install?

Please, please help me.

Re: Forgot password

PostPosted: 21. October 2010 22:14
by JonB
OK - how many times does it need to be said - DO NOT REMOVE or CHANGE the MySQL root user?

there's actaully no need to change or emove the root user -- as long as you create a strong password for it, AND you don't use the 'root' user for day to day operations. You simply create a new MySQL 'superuser - and use GRANT to give whaterver privileges you need to the new user.

How "exactly" did you make this "chamge?" Do you really mean you changed the root user's password?

Whatever - read this very clear tutorial on basic MySQL security

http://www.kitebird.com/articles/ins-sec.html

FOR A possible immediate fix:

you can try this recipe:


1st - copy the my.ini file in xampp\mysql\bin to \xammp\mysql\data
2nd - rename xampp\mysql\data\my.ini to xampp\mysql\data\my.cnf
3rd - now open a command prompt in \xampp\mysql\
4th - run 'resetroot,bat" from the command line:
c:\xampp\mysql\>resetroot.bat

reference:
http://bravo.newnetenterprises.com/wordpress/?p=367

That is suppoed to re-create a clean root and PMA user for the database - I have tested it (obviously) - and it worked correctly AFAIK.

IF THIS WORKED - 2 things:

Learn how to make backups
Read that security article before you forget to


Good Luck
:roll:

Re: Forgot password

PostPosted: 22. October 2010 17:39
by spanner
Well, I've been doing this shit all fucking day and none of it will work.

I changed all the config.inc/conf.php files ... and I can see the changed user and password values ... can't log in.

tried all the make new --init- & mysql.init files

SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(‘password’);


Looked everywhere ... tried everything and fuck all works.

Nada. Zip :(

On Off On Off

etc...

Nothing.

Apache server works but I can't change the myphp admin passwords and access from the Apache security page either.

Delete files, move files, rename the fucking files ... nothing works.

I think it is stored in the webdav document in xampp>security>webdav because the xampp password is in there in a Xampp users file too ... but they are both encrypted and I can't fucking read it.

I'm gonna have to reinstall all this shit again ain't I?

Re: Forgot password

PostPosted: 22. October 2010 20:44
by JonB
dId you actually use the 'resetroot.bat'? :shock:
and then try to start the mySQL monitor? (the Command Line Interface) or use mysqldump.exe with the user root????
:?:

well - no matter -
there's a good chance of breaking that encryption (I think)

google this:
decrypt md5 password online

I'm sure this will be pouring salt in the wound, BUT for next time - if you use the XAMPP security page - you have the check option to create plaintext files in the secure folder with the decrypted info.

Good Luck

Re: Forgot password

PostPosted: 23. October 2010 11:19
by spanner
Yes I tried the resetroot.bat

and the mysqldump

and I tried to crack the hash both online and here with Cain ... all to no avail :(

... but I shall keep trying.

I don;t like to give up :D

Re: Forgot password

PostPosted: 23. October 2010 15:36
by spanner
This is the admin cmd prompt readout of what happens when I do the various things as recommended in various places ...

Code: Select all
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Zorro>cd c:\xampp\mysql

c:\xampp\mysql>C:\xampp\mysql\resetroot.bat
101023 15:05:07 [Warning] Can't create test file \usr\local\mysql\data\Zorro-box
.lower-test
101023 15:05:07 [Warning] Can't create test file \usr\local\mysql\data\Zorro-box
.lower-test
mysql\bin\mysqld.exe: Can't change dir to '\usr\local\\mysql\data\' (Errcode: 2)

101023 15:05:07 [ERROR] Aborting

101023 15:05:07 [Note] mysql\bin\mysqld.exe: Shutdown complete


Passwoerter fuer Benutzer "root" und "pma" wurden nicht geloescht!
Passwords for user "root" and "pma" were not deleted!

Press any key to continue . . .

c:\xampp\mysql>cd c:\xampp\mysql\bin

c:\xampp\mysql\bin>C:\xampp\mysql\bin\mysql.exe
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N
O)

c:\xampp\mysql\bin>C:\xampp\mysql\bin\mysqld.exe
101023 15:06:09 [Warning] Can't create test file \usr\local\mysql\data\Zorro-box
.lower-test
101023 15:06:09 [Warning] Can't create test file \usr\local\mysql\data\Zorro-box
.lower-test
C:\xampp\mysql\bin\mysqld.exe: Can't change dir to '\usr\local\\mysql\data\' (Er
rcode: 2)
101023 15:06:09 [ERROR] Aborting

101023 15:06:09 [Note] C:\xampp\mysql\bin\mysqld.exe: Shutdown complete


c:\xampp\mysql\bin>C:\xampp\mysql\bin\mysqldump.exe
Usage: mysqldump [OPTIONS] database [tables]
OR     mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR     mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help

c:\xampp\mysql\bin>C:\xampp\mysql\bin\mysqldump.exe database
mysqldump: Got error: 1045: Access denied for user 'ODBC'@'localhost' (using pas
sword: NO) when trying to connect

c:\xampp\mysql\bin>



As you can see, nothing appears to be working ...

I can't get in because I have no password.

I can not change the password because I can't get in.

The resetpassword program run from xampp\mysql does not work. (Even when attempted using the 'mysql-init.txt password change and flush' script operation).


All of my previous attemps at moving, renaming, rewriting etc ... the various .inf .conf .txt files from and too the various places alluded to here and, on the internet in general , have come to no fruitful avail either :cry:

I am at a loss as to what to do, really, perhaps a reinstall is the only option.

Re: Forgot password

PostPosted: 23. October 2010 16:06
by JonB
you DIDN'T do the copy my.ini to my.cnf fix

http://bravo.newnetenterprises.com/wordpress/?p=367

That is the issue with the resetroot.bat problem - why you get all the warnings in German) AND why Command Line standard MySQL commands to use the init files fail.

Good Luck
:)

Re: Forgot password

PostPosted: 23. October 2010 17:53
by spanner
JonB wrote:you DIDN'T do the copy my.ini to my.cnf fix

http://bravo.newnetenterprises.com/wordpress/?p=367

That is the issue with the resetroot.bat problem - why you get all the warnings in German) AND why Command Line standard MySQL commands to use the init files fail.

Good Luck
:)



Yes I did.

I've done it a few times now.

It never works.

Re: Forgot password

PostPosted: 24. October 2010 03:11
by JonB
Well -

I just tested on my 'home machines' that run xampp (and searched for one that had my.cnf in the mysql\data folder - no dice. and the 'trick didn't work either.

So, I'm thinking i must have done it on one of my two machines at work. AND I think I may have had to change the syntax or location, so I may have not documented a step. (bad server geek) - BUT when I get to work, I'll check it out and see if it is still working and if so what is different.

Sorry you are not having any luck
:(

Re: Forgot password

PostPosted: 24. October 2010 11:13
by spanner
Yes.

There's something 'weird' about that file to be copied to the data folder, I mean, changing the name doesn't do anything does it ? other than changing it to my.cnf it is still a .ini file (which is a configuration file anyway) ... if you see what I mean :?

Why change the name?

I can see how changing the .cnf would work in linux because it would change the file type ... not just the name of the file ... I think ?

Anyway, I've tried it with and without renaming and it still won't work. Perhaps there is another file to copy? I think it might be mysql_config so I'm gonna see what happens ...

Re: Forgot password

PostPosted: 24. October 2010 21:07
by JonB
FYI - Linux/Unix has no 'file types' in the Windows sense. (meaning they are associated with any application).

when I get it working right - I'll tell you the details. My clue was the outpust of the batch file - its lloking to use the default locations from soem *nix filesystem.

these are MySQL Linux/Unix OS errors
Code: Select all
101023 15:05:07 [Warning] Can't create test file \usr\local\mysql\data\Zorro-box
.lower-test
101023 15:05:07 [Warning] Can't create test file \usr\local\mysql\data\Zorro-box
.lower-test
mysql\bin\mysqld.exe: Can't change dir to '\usr\local\\mysql\data\' (Errcode: 2)


SO I knew it was not reading the configuration file, which on Unix MySQL installs is called 'my.cnf'. :idea: aha - we need to tell it what the configuration is,,,

thus the fix - which I must not have completely documented.

(I have several Linux servers running MySQL, although with a traditional LAMP stack, not XAMPP).

:shock:

Re: Forgot password

PostPosted: 24. October 2010 23:14
by Altrea
JonB wrote:Well -

I just tested on my 'home machines' that run xampp (and searched for one that had my.cnf in the mysql\data folder - no dice. and the 'trick didn't work either.

So, I'm thinking i must have done it on one of my two machines at work. AND I think I may have had to change the syntax or location, so I may have not documented a step. (bad server geek) - BUT when I get to work, I'll check it out and see if it is still working and if so what is different.

Sorry you are not having any luck
:(


I remembered a post in the german part of the board. viewtopic.php?f=4&t=41834#p165239
resetroot.bat must be changed in the windows version of XAMPP.

here is the little fix in english:
- open resetroot.bat file in your editor
- after the parameter "--no-defaults" add you mysql data directory with this syntax: --datadir=c:/xampp/mysql/data
- save the file
- execute the file

this should work on windows

Re: Forgot password

PostPosted: 26. October 2010 14:07
by spanner
I remembered a post in the german part of the board. viewtopic.php?f=4&t=41834#p165239
resetroot.bat must be changed in the windows version of XAMPP.

here is the little fix in english:
- open resetroot.bat file in your editor
- after the parameter "--no-defaults" add you mysql data directory with this syntax: --datadir=c:/xampp/mysql/data
- save the file
- execute the file

this should work on windows[/quote]

Thank you all so very much :D

It worked :idea: ... marvelous

Re: Forgot password

PostPosted: 26. October 2010 18:39
by Altrea
I'm glad my post was helpful to solve your problem :D

Re: Forgot password

PostPosted: 24. June 2011 00:25
by lfrazier
not working for me.

This is on a 2003 Server and I added this to the bat file –datadir=c:/xampp/mysql/data
I am getting this error when running the resetroot.bat:


Code: Select all
110623 16:24:00 [Warning] Can't create test file \usr\local\mysql\data\DR-WEB-INT-01.lower-test
110623 16:24:00 [Warning] Can't create test file \usr\local\mysql\data\DR-WEB-INT-01.lower-test
mysql\bin\mysqld.exe: Can't change dir to '\usr\local\\mysql\data\' (Errcode: 2)
110623 16:24:00 [ERROR] Aborting

110623 16:24:00 [Note] mysql\bin\mysqld.exe: Shutdown complete


Passwoerter fuer Benutzer "root" und "pma" wurden nicht geloescht!
Passwords for user "root" and "pma" were not deleted!

Press any key to continue . . .