mysqld --initialize --defaults-file Uses Wrong Data Directory (datadir) And Gives Error: "--initialize specified but the data directory has files in it. Aborting."

(Doc ID 2146557.1)

Last updated on FEBRUARY 12, 2017

Applies to:

MySQL Server - Version 5.7 and later
Information in this document applies to any platform.


When initializing the data directory manually using mysqld, the mysqld command returns this error while --defaults-file is a valid option and the data directory defined by --datadir in the given option file is empty.



Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms