MySQL Data Directory Initialization

Tutorial example on how to initialize the MySQL server data directory with the 'mysqld --initialize-insecure' command, which will create a root user without password.

If you are installing MySQL Server using the Non-Install ZIP package, you need to initialize MySQL server data directory manually. Here is how I did it:

1. Make sure MySQL Server is installed in \local\mysql directory and there is no \local\mysql\data directory.

2. Run the MySQL data initialization command:

herong> \local\mysql\bin\mysqld --initialize-insecure

3. Check log file:

herong> type \local\mysql\data\localhost.err

[System] [MY-013169] [Server] \local\mysql\bin\mysqld
   (mysqld 8.0.16) initializing of server in progress as process 8052

[Warning] [MY-010453] [Server] root@localhost is created with
   an empty password ! Please consider switching off the
   --initialize-insecure option.

[System] [MY-013170] [Server] \local\mysql\bin\mysqld
   (mysqld 8.0.16) initializing of server has completed

Warning message tells us that server data directory was created without a root password. This is because I used the "--initialize-insecure" option. No root password is fine for running a MySQL server on my local computer.

See next tutorial on how to create MySQL server service and start it.

Table of Contents

 About This Book

 Introduction of SQL

MySQL Introduction and Installation

 What Is MySQL

 Downloading and Installing MySQL

 Issues during MySQL Installation

 Starting and Stopping MySQL Server

 Un-Installing MySQL

 MySQL Command Line Client Tool

 What Is MySQL Shell

 What Is MySQL Workbench

 Using MySQL Non-Install Package

MySQL Data Directory Initialization

 Creating MySQL Windows Service

 %mysql% Variable for MySQL Server Path

 Introduction of MySQL Programs

 PHP Programs and MySQL Server

 Perl Programs and MySQL Servers

 Java Programs and MySQL Servers

 Datatypes and Data Literals

 Operations and Expressions

 Character Strings and Bit Strings

 Commonly Used Functions

 Table Column Types for Different Types of Values

 Using DDL to Create Tables and Indexes

 Using DML to Insert, Update and Delete Records

 Using SELECT to Query Database

 Window Functions for Statistical Analysis

 Use Index for Better Performance

 Transaction Management and Isolation Levels

 Locks Used in MySQL

 Defining and Calling Stored Procedures

 Variables, Loops and Cursors Used in Stored Procedures

 System, User-Defined and Stored Procedure Variables

 MySQL Server Administration

 Storage Engines in MySQL Server

 InnoDB Storage Engine - Primary and Secondary Indexes

 Performance Tuning and Optimization

 Bulk Changes on Large Tables

 MySQL Server on macOS

 Installing MySQL Server on Linux

 Connection, Performance and Second Instance on Linux

 Archived Tutorials


 Full Version in PDF/EPUB