Documentation Home
MySQL and Windows
Related Documentation Download this Excerpt
PDF (US Ltr) - 0.8Mb
PDF (A4) - 0.8Mb
EPUB - 0.7Mb
HTML Download (TGZ) - 0.7Mb
HTML Download (Zip) - 0.7Mb

MySQL and Windows  /  Installing MySQL on Microsoft Windows  /  Troubleshooting a MySQL Installation Under Windows

1.5 Troubleshooting a MySQL Installation Under Windows

When installing and running MySQL for the first time, you may encounter certain errors that prevent the MySQL server from starting. The purpose of this section is to help you diagnose and correct some of these errors.

Your first resource when troubleshooting server issues is the error log. The MySQL server uses the error log to record information relevant to the error that prevents the server from starting. The error log is located in the data directory specified in your my.ini file. The default data directory location is C:\Program Files\MySQL\MySQL Server 5.0\data. See The Error Log.

Another source of information regarding possible errors is the console messages displayed when the MySQL service is starting. Use the NET START MySQL command from the command line after installing mysqld as a service to see any error messages regarding the starting of the MySQL server as a service. See Section 1.4.7, “Starting MySQL as a Windows Service”.

The following examples show other common error messages you may encounter when installing MySQL and starting the server for the first time:

  • If the MySQL server cannot find the mysql privileges database or other critical files, you may see these messages:

    System error 1067 has occurred.
    Fatal error: Can't open privilege tables: Table '' doesn't exist

    These messages often occur when the MySQL base or data directories are installed in different locations than the default locations (C:\Program Files\MySQL\MySQL Server 5.0 and C:\Program Files\MySQL\MySQL Server 5.0\data, respectively).

    This situation may occur when MySQL is upgraded and installed to a new location, but the configuration file is not updated to reflect the new location. In addition, there may be old and new configuration files that conflict. Be sure to delete or rename any old configuration files when upgrading MySQL.

    If you have installed MySQL to a directory other than C:\Program Files\MySQL\MySQL Server 5.0, you need to ensure that the MySQL server is aware of this through the use of a configuration (my.ini) file. The my.ini file needs to be located in your Windows directory, typically C:\WINDOWS. You can determine its exact location from the value of the WINDIR environment variable by issuing the following command from the command prompt:

    shell> echo %WINDIR%

    An option file can be created and modified with any text editor, such as Notepad. For example, if MySQL is installed in E:\mysql and the data directory is D:\MySQLdata, you can create the option file and set up a [mysqld] section to specify values for the basedir and datadir options:

    # set basedir to your installation path
    # set datadir to the location of your data directory

    Note that Windows path names are specified in option files using (forward) slashes rather than backslashes. If you do use backslashes, double them:

    # set basedir to your installation path
    basedir=C:\\Program Files\\MySQL\\MySQL Server 5.0
    # set datadir to the location of your data directory

    The rules for use of backslash in option file values are given in Using Option Files.

    If you change the datadir value in your MySQL configuration file, you must move the contents of the existing MySQL data directory before restarting the MySQL server.

    See Section 1.4.2, “Creating an Option File”.

  • If you reinstall or upgrade MySQL without first stopping and removing the existing MySQL service and install MySQL using the MySQL Configuration Wizard, you may see this error:

    Error: Cannot create Windows service for MySql. Error: 0

    This occurs when the Configuration Wizard tries to install the service and finds an existing service with the same name.

    One solution to this problem is to choose a service name other than mysql when using the configuration wizard. This enables the new service to be installed correctly, but leaves the outdated service in place. Although this is harmless, it is best to remove old services that are no longer in use.

    To permanently remove the old mysql service, execute the following command as a user with administrative privileges, on the command-line:

    shell> sc delete mysql
    [SC] DeleteService SUCCESS

    If the sc utility is not available for your version of Windows, download the delsrv utility from and use the delsrv mysql syntax.

Download this Excerpt
PDF (US Ltr) - 0.8Mb
PDF (A4) - 0.8Mb
EPUB - 0.7Mb
HTML Download (TGZ) - 0.7Mb
HTML Download (Zip) - 0.7Mb
User Comments
  Posted by Johannes Braunias on January 16, 2012
Try the steps here:

For me, it helped. The service even started at step 4 of this guide.
  Posted by Olivier Olivier on April 18, 2012
5.5.23 By default, my.ini is in C:\ProgramData\MySQL\MySQL SERVER 5.5 and C:\ProgramData is an hidden folder.
Sign Up Login You must be logged in to post a comment.