Category Archives: web stuff

Fixing MySQL Service Could Not Start, 1067 Errors

If you’ve unzipped mysql out to a folder and you set it up to run as a service, like so

C:\mysql5_x64\bin\mysqld-nt.exe --install-manual

You might try to launch the service from the Control Panel -> Administrative Tools -> Services Window. But if you’re getting the error message:

‘Could not start the MySQL service on Local Computer

Error 1067: The process terminated unexpectedly.’

Running from the command line:

C:\mysql5_x64\bin\mysqld-nt.exe --console

Should work fine. So what’s the problem? Well, you may be missing your my.ini file. Create the file (you can copy one of the defaults that come with it such as my-small.ini), and make the following changes by adding the basedir & datadir lines, so it looks something like this:

# The MySQL server
port        = 3306
socket        = /tmp/mysql.sock

If you try to launch the service again, you should feel alot happier.

Some of the readers have put in some helpful comments, which I’ll include here

Take a look at your error log by looking in:

“C:\Documents and Settings\All Users.WINDOWS\Application Data\MySQL\”

Then click on the “MySQL Server X.X\” folder and then “data\”

Find the file [MY-DOMAIN-NAME].err and open it using notepad

Another possible cause of the 1067 error might be faulty my.ini settings.

So the general tip from me would be: Try to think of any reconfigurations you’ve done recently. That might be what’s causing this. —ChromaWoods

We were getting a 1067 error because (we think) we’d been unable to successfully complete a reinstall after mixing up the original root password [on the mysql server].

Our solution in the end was to _completely_ uninstall MySQL and reinstall. The tricky part is that the uninstall requires three steps:

1. Uninstall via Add/Remove Programs from the Control Panel.

2. Delete the Base directory — likely C:/Program Files/MySQL

3. Delete the Data directory — likely C:/Documents and Settings/All Users/Application Data/MySQL

Finding the Data directory may be a bit tricky, since the Application Data folder is hidden by default. If you change your Folder Options so you can view the Application Data folder and still cannot see it, type the path (from step 3) into Run from the Start Menu to open the folder.

Once you’ve uninstalled MySQL and deleted these two folders, you should be ready to start fresh!


Installing Apache 2.2 PHP 5.2 MySQL 5 on Windows 32bit or x64

This post is about getting MySQL working with Apache/PHP because sometimes it can be a pain to get it working.

If you are having trouble getting PHP working with Apache, one reader called Nurlan has found a guide to using the PHP MSI install wizard. You can find it at

Before You Begin

  • Read carefully
  • Keep backups of the files you change (make a copy before you change them)
  • Some long lines of text may run off the page on this website, so you need to copy the whole line down correctly

Downloading & Installing

Download the apache 2.2.8 installer (I used the one with SSL) and install it, I’ve installed to c:\apache2.2. You can run it from the start menu.

Download the PHP 5.2.6 zip and extract it (I used the no-msi zip). You don’t want space characters in the path, so I suggest C:\php5.2.6.

Download MySQL 5.01. I installed to C:\mysql5 because I didn’t use the installer. It will work just as well if you use the install wizard. Once installed, you can use the mysql monitor, which appears in the system tray (next to the clock) to start/stop the sql server.

Try  the MySQL GUI tools.  You can login using the mysql administrator, so you can setup usernames etc. You can edit schema (databases) and tables etc. using the Query Browser, it’s pretty straight forward to use.

Configuring Apache to use PHP

I like to make it obvious where I’ve made changes to files, so I can easily see them later. I do this by putting long comment lines above and below the changes.

Go into httpd.conf. find the bunch of LoadModule lines and add this one.

LoadModule php5_module C:/php5.2.6/php5apache2_2.dll

So In my file it looks like this

# Last changed on 28 July 2008.
# This line enables the PHP module
LoadModule php5_module C:/php5.2.6/php5apache2_2.dll

Add this line as well (i put it after the loadmodule line)

PHPIniDir C:/php5.2.6/

ZAUR left a useful comment on 29th June 2008. He mentions that it’s important not to have quotes around your path in this line. Thanks Zaur.

Find the bunch of AddType lines and add this one

AddType application/x-httpd-php .php

Configuring PHP to use MySQL

Go into C:\php5.2.6 and copy the file called php.ini-recommended, paste it into the same folder and rename it to php.ini. So you have a duplicate of php.ini-recommended called php.ini.

Find and edit the following lines;

doc_root = "C:\Apache2.2\www"
extension_dir = "C:\php5.2.6\ext"

uncomment this line (take the ‘;’ character out)



Now restart apache, everything should be working. You can check up on php by using the phpinfo() function. Just put the following line into a file called something like phpinfo.php and place it in your htdocs folder:

<?php phpinfo(); ?>

If php is running, it will give you a page with lots of information. Look for the mysql section, it comes after PHP Credits, Configuration, PHPCore etc. If it isn’t there, that means PHP is running but MySQL isn’t playing ball.

Check all the edits you’ve made the the config files, make sure they all make sense, sometimes you put the wrong slashes in, or the wrong folder name and it’s very hard to spot.

If you get the following error message:

unable to load C:\php5.2.6\ext\php_mysql.dll’

This is the most frustrating part of getting mysql working. PHP won’t run the mysql extension and you have to do stupid things to get it to work!

Copy C:\php5.2.6\libmysql.dll to c:\windows\system32\ and restart apache

IF YOU ARE USING WINDOWS XP x64 and moving the file to system32 doesn’t work, move it to C:\WINDOWS.



These guys have a suggestion. When copying libmysql, andy23 says:
Copy file libmysql.dll in C:\php5.2.6 to C:\apache2.2\bin\ AND C:\windows\system32

Hopefully, this will have got your servers up and running. Go ahead and try out wordpress, joomla, osCommerce etc.

If you find you can’t login to the mysql server, check my mysql posts with instructions on how to setup mysql user accounts.

Thanks to all the people contributing their time to open Source projects, and thanks to you for reading.