MySQL service will not start on Windows: System error 1067 has occurred
System 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.
Fix it fast
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"2Match what you see, then jump to its fix
- 1
Fatal 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
The 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
- 1
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:/MySQLdata3Verify
Start the service again; it reports that it was started successfully.
NET START MySQLConfirmed by dev.mysql.com
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 folder3Verify
Start the service again and check that the .err file shows no new errors.
NET START MySQLConfirmed by dev.mysql.com
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:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- ShopGoAn e-commerce aggregator with a Python scraping engine behind its catalog, past 10K Google Play downloads.
Related fixes
Databases
Installing the Airflow MySQL provider fails on pkg-config or mysqlclient
Building the mysqlclient wheel fails during the install
The Airflow MySQL provider depends on mysqlclient, which pip compiles against the MySQL C client library.
2 causes, each with a fixDatabases
A query on Aurora MySQL dies with 'table /rdsdbdata/tmp/#sql... is full'
ERROR 1114 (HY000): The table '/rdsdbdata/tmp/#sqlfd_1586_2' is full
In Aurora MySQL 3, internal temporary tables share one pool, and when that pool and the memory-mapped overflow file are used up, a reader instance ends the query with error 1114.
3 causes, each with a fixDatabases
Azure Database for MySQL refuses a connection that does not use SSL
ERROR 3159 (HY000): Connections using insecure transport are prohibited while --require_secure_transport=ON.
Azure Database for MySQL Flexible Server requires encrypted connections by default (require_secure_transport = ON, TLS 1.2).
4 causes, each with a fixDatabases
Compiling a C or C++ program that includes mysql.h fails
undefined reference to `mysql_init'
The compiler only finds mysql.h when the MySQL client development files are installed and their folder is on the include path.
3 causes, each with a fixDatabases
DBeaver fails to resolve Maven dependencies when downloading a database driver
A driver library does not download automatically
DBeaver downloads driver jars from a Maven repository.
3 causes, each with a fixDatabases
DBeaver cannot verify the MySQL server certificate
unable to find valid certification path to requested target
DBeaver's MySQL driver is checking the server certificate and Java does not trust the CA that signed it.
2 causes, each with a fix