Page 1 of 1

XAMPP wont let me use MySql

PostPosted: 06. May 2011 17:21
by Darkranger85
I'm trying to follow some php tutorials that use XAMPP but no matter what I do I keep getting this error.

"ERROR: MySql service not started [-1]"

Can anyone help me with this?

Thanks!

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 00:38
by Sharley
Check in the XAMPP Control Panel that Apache and MySQL are both showing a green running indication.

Remove and ticks in the Svc check boxes.

What version of XAMPP and which Windows are you using?

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 01:04
by Darkranger85
Windows 7
XAMPP Control Panel 2.5

The Apache does have the green "running" indicator but MySql does not, when I tell it to run it gives me the aforementioned error.

Both are checked as a service. If it's relevant I can't uncheck the MySql service, it unchecks and then immediately rechecks.

EDIT: Ok, now the box will uncheck and when I click start for MySql it says in the bottom that it started but the green "running" box does not come up.

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 01:12
by Sharley
It is relevant as somehow it is preventing MySQL in XAMPP from starting and hence you will not be able to connect to a database.

If using XAMPP 1.7.4 then go to \xampp\mysql folder and right click on mysql_uninstallservice.bat and select to run as an administrator if you have problems running it normally (by double clicking it).

If it was successful then try and start MySQL from the XCP again but do not tick the Svc check box, and best also to remove the tick in the Apache Svc check box also.

If it returns an error message please paste it here.

Your MySQL seems not to be running and may be an issue with repeated uninstall/reinstalling of XAMPP.

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 01:15
by Darkranger85
It said that "the service doesn't exist"

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 01:21
by Sharley
Darkranger85 wrote:EDIT: Ok, now the box will uncheck and when I click start for MySql it says in the bottom that it started but the green "running" box does not come up.
Try a reboot to see if it clears any dead wood. :) Then try again.

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 01:29
by Darkranger85
Ok, I rebooted and turned it on and the running thing came up but then went off after a few seconds. I clicked status just to check and it confirms that its not running. :(

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 01:38
by Sharley
OK, it seems you may have another MySQL instance on your PC.

Try and find it and stop it running if you find it.

To help, download this little free app CurrPorts from here, it does not need installing.
http://www.nirsoft.net/utils/cports.html
Try and find what is using port 3306.

You could also check using Windows Task Manager for mysqld.exe and kill it if you find a process running.

Also in the \xampp\mysql\data folder you should see a mysql_error.log file see if there are any clues in this file at about the date and time of your last attempt at starting MySQL in XAMPP.

Good luck. :)

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 01:52
by Darkranger85
Ok, I looked in Task Manager and I don't see a MySql instance in there.

I downloaded the program and if I'm reading it right I don't see anything on Port 3306.

And last, but not least, I checked the error log and tried to search for "mysql" in there and didn't find anything.

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 02:00
by Sharley
Delete the contents of the \xampp\mysql\data\mysql_error.log file completely then save and close it.

Now try and start MySQL again from the Control Panel.

After it shows the green running and then stops open the mysql_error.log file again and paste the contents here please.

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 02:03
by Darkranger85
110506 21:02:35 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use Windows interlocked functions
InnoDB: Compressed tables use zlib 1.2.3
110506 21:02:35 InnoDB: Initializing buffer pool, size = 16.0M
110506 21:02:35 InnoDB: Completed initialization of buffer pool
110506 21:02:35 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
110506 21:02:35 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
110506 21:02:36 InnoDB: 1.1.4 started; log sequence number 1595675
110506 21:02:36 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: 'host' (errno: 2)

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 02:19
by Sharley
Code: Select all
110506 21:02:36 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: 'host' (errno: 2)
Seems it may be a corrupted data file in the mysql\data folder.

It would be advisable to uninstall correctly and do a fresh install by following this procedure.

Make sure no ticks in any of the Svc check boxes.
Stop all XAMPP components.
Pres Exit on the control panel.
Delete the xampp folder completely.
Reboot as it often helps clean things up.

Download the ZIP version of XAMPP.
Extract the xampp folder to the C:\ drive or the root of any drive or partition like D:\, E:\, etc.
Run the C:\xampp\setup_xampp.bat file (this sets the paths for you).
Open the XAMPP Control Panel and start Apache and MySQL (do not tick any Svc boxes)
When both Apache and MySQL are running type http://localhost/ select your language and exercise all the demos.

You should now be able to proceed and enjoy XAMPP. :)


Edit:
Similar issue and 2 solutions here:
viewtopic.php?f=16&t=36263
Reinstall or download the ZIP and copy over the mysql\data folder.
I prefer a fresh install in case there are other corruption issues yet to raise their ugly heads.

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 02:31
by Darkranger85
It works!!

Thank you very much for your help!! XD

Re: XAMPP wont let me use MySql

PostPosted: 07. May 2011 02:36
by Sharley
Darkranger85 wrote:It works!!
Thank you very much for your help!! XD

You're most welcome. :D
Good luck and best wishes.