content_image/873038.jpg content_image/873057.jpg
bin\mysqld --initialize --console bin\mysqld --initialize-insecure --console 

<img src='content_image/873038.jpg'>

## Note 

Data directory initialization might fail if required system libraries are missing. For example, you might see an error like this: 

bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory 

## Initializing the Data Directory 

If this happens, you must install the missing libraries manually or with your system’s package manager. Then retry the data directory initialization command. 

It might be necessary to specify other options such as --basedir  or --datadir  if mysqld  cannot identify the correct locations for the installation directory or data directory. For example (enter the command on a single line): 

bin/mysqld --initialize --user=mysql --basedir=/opt/mysql/mysql --datadir=/opt/mysql/mysql/data 

Alternatively, put the relevant option settings in an option file and pass the name of that file to mysqld . For Unix and Unix-like systems, suppose that the option file name is /opt/mysql/mysql/etc/my.cnf . Put these lines in the file: 

[mysqld] basedir=/opt/mysql/mysql datadir=/opt/mysql/mysql/data 

Then invoke mysqld  as follows (enter the command on a single line with the --defaults-file  option first): 

bin/mysqld --defaults-file=/opt/mysql/mysql/etc/my.cnf --initialize --user=mysql 

On Windows, suppose that C:\my.ini  contains these lines: 

[mysqld] basedir=C:\\Program Files\\MySQL\\MySQL Server 8.0 datadir=D:\\MySQLdata 

Then invoke mysqld  as follows (enter the command on a single line with the --defaults-file  option first): 

## Server Actions During Data Directory Initialization 

bin\mysqld --defaults-file=C:\my.ini --initialize --console 

<img src='content_image/873057.jpg'>

## Note 

The data directory initialization sequence performed by the server does not substitute for the actions performed by mysql_secure_installation  and mysql_ssl_rsa_setup . See Section 4.4.2, “mysql_secure_installation — Improve MySQL Installation Security” , and Section 4.4.3, “mysql_ssl_rsa_setup — Create SSL/RSA Files” . 

When invoked with the --initialize  or --initialize-insecure  option, mysqld  performs the following actions during the data directory initialization sequence: 

