how to fix MySQL database [Solved]

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

how to fix MySQL database [Solved]

Postby lambiv » 13. February 2012 05:23

Ok, so this wasn't clever...

I was without internet for a few days so had been working on a website that I had set up offline in XAMPP (on Window's Vista, the website uses Joomla and Virtuemart). I ran out of things I could do without having internet so decided I would start on another website, also offline. I'm pretty new to XAMPP and Joomla so thought I would just be able to create another folder, put another installation of Joomla in it and create another database for it to run off. Which I done and it was all looking good for the new site. The problem is, when I went back to view my original site, which I've spent a lot of time creating, I now get the message 'Database Error: Unable to connect to the database:Could not connect to MySQL', same if I try and access the administrator area of the site.

So I guess I stuffed up. If I open up the XAMPP control panel and try and go to the MySQL admin page then I also get the message 'phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.'

From having a bit of a Google search, I'm thinking that the old site no longer works because it's now pointing to the new database and all the settings are wrong? (hence the username and password are incorrect). Unfortunately I have no idea how to fix this. My problem also is that I can't actually remember what the database user name and password were... And can't access the admin page to check or change these.....

Help! I really don't want to lose the old site as I've spent a load of time getting it right. If anyone knows a way to recover the site I would be extremely grateful!
lambiv
 
Posts: 2
Joined: 13. February 2012 05:07
Operating System: Windows Vista

Re: how to fix MySQL database

Postby JonB » 13. February 2012 15:30

OK - here's a suggestion -

Use a tool to do the work. Oracle, the 'owners' of MySQL have a database tool called MySQL Workbench. It can connect to local or remote databases, with or without XAMPP or phpMyAdmin. You will only have to be able to start MySQL on the target machine (presumably your machine).

As long as you know the 'root' password, you will be able to work with, and.or extract/export your database, fix users/passwords etc.
If you DON'T know the 'root' PW for the local MySQL instance, XAMPP has a 'resetroot.bat' script in the \xampp\mysql folder. If 'resetroot' chokes there's a fix on my XAMPP site:

http://bravo.newnetenterprises.com/word ... for-mysql/

I design databases for a living and MySQL Workbench is one of my favorite tools, and its FREE (unlike many others) plus it works the same on both my Windows and Linux workstations. There are a few things phpMyAdmin can do better, and neither is a replacement for 'power tools' like Navicat Enterprise. But for what you want to do, its ideal.

http://www.mysql.com/products/workbench/

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: how to fix MySQL database

Postby lambiv » 14. February 2012 00:29

Yay! I have my website back! Thank you SO much!

I couldn't use the Workbench tool at first as I didn't know the password. I tried running the 'resetroot' script which didn't work at first but I realised after looking at the tips on your website that it was because I hadn't stopped the database running first. I stopped that in the XAMPP control panel and the script then ran successfully. This let me access the XAMPP admin page again so I deleted the new database I had created (not sure if this was necessary but it seemed like a good plan). Anyway, checked the original site and it is now back exactly as it was before I done this which is fantastic, thank you very, very much! :D

PS - the Workbench tool also now works and I'm sure it will be a useful tool to have in future
lambiv
 
Posts: 2
Joined: 13. February 2012 05:07
Operating System: Windows Vista

Re: how to fix MySQL database [Solved]

Postby JonB » 14. February 2012 01:20

Well that's great - Good luck and I'm glad it worked out..

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: how to fix MySQL database [Solved]

Postby alva » 04. December 2013 05:53

When my MySQL file got damaged I was very annoyed. I don’t want to lose my important files but as came across MySQL Repair Tool I was really happy this repair tool is very helpful in order to recover the damaged, corrupted or inaccessible file. Hope it will be useful to you.For more information follow the link:

http://mysql.filerepairtool.net/
alva
 
Posts: 1
Joined: 04. December 2013 05:49
Operating System: mac


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 131 guests