Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Databases and Redis

MySQL service will not start on Windows: System error 1067 has occurred

ErrorSystem error 1067 has occurred.

Short answer

Error 1067 means the MySQL service process exited while starting. Run the service from a command prompt to see the message, and read the .err file in the data directory. The documented causes are base or data directories that are not in the default place, and a temp folder the service account cannot write to.

  • Applies to MySQL 8.4 on Windows 10 and 11, MySQL Server 8.0
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Start the service from an administrator command prompt to see the error text, then open the newest .err file in the data directory. Replace the service name if yours is not MySQL.

    NET START MySQL
    dir "C:\Program Files\MySQL\MySQL Server 8.4\data\*.err"
  2. 2Match what you see, then jump to its fix

    1. 1Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist, right after System error 1067The base or data directory is not where the server expectsFix
    2. 2The service fails right after a change to user TEMP or TMP variables, a --tmpdir option, or the account that runs the serviceThe service account cannot write to the temp directoryFix

What does the error look like?

  • System error 1067 has occurred.
  • Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

Cause 1 of 2

The base or data directory is not where the server expects

1Check

This happens when MySQL is installed or its data lives somewhere other than the default location, and the server has not been told. Look at the basedir and datadir lines of the option file the service uses.

REM open the my.ini the service uses and read basedir and datadir
dir "C:\Program Files\MySQL\MySQL Server 8.4\data"

2Fix

Put both paths in the [mysqld] section of the option file. If you change datadir, move the existing data directory contents to the new place before you start the server again.

[mysqld]
# set basedir to your installation path
basedir=E:/mysql
# set datadir to the location of your data directory
datadir=D:/MySQLdata

3Verify

Start the service again; it reports that it was started successfully.

NET START MySQL

Confirmed by dev.mysql.com

Did this fix it?

Cause 2 of 2

The service account cannot write to the temp directory

1Check

The default account for the service is LocalSystem, whose TEMP and TMP point to C:\Windows\Temp. If TEMP, TMP or TMPDIR point somewhere else, or --tmpdir was used, the account needs write access to that folder.

echo %TEMP% %TMP% %TMPDIR%

2Fix

Point those variables at a folder the service account can write to, or grant that account write access to the folder you chose.

REM Windows: set TEMP and TMP for the service account to a writable folder, or grant it write access to that folder

3Verify

Start the service again and check that the .err file shows no new errors.

NET START MySQL

Confirmed by dev.mysql.com

Did this fix it?

How do I stop it coming back?

  • Install the service with the option file it should use: mysqld --install MySQL --defaults-file=C:\my-opts.cnf.
  • When you move the data directory, change datadir in the option file in the same step.
  • Run the server by hand with --console after any change; it can show the message that the service hides.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.