Creating MySQL Windows Service

Tutorial example on how to create MySQL Windows Service with the 'mysqld --install' command. You can start MySQL server by start the MySQL service.

If you are installing MySQL Server using the Non-Install ZIP package, you need to create MySQL Windows service manually. Here is how I did it:

1. Make sure MySQL Server is installed in \local\mysql directory and the \local\mysql\data directory has been initialized.

2. Start a command line window as an administrator user.

3. Run the MySQL Windows service installation command:

herong> \local\mysql\bin\mysqld --install

Service successfully installed.

4. Go to "Control panel > Services". You see "MySQL" service is listed.

5. Open "MySQL" service and click "Start" to start the MySQL Server.

6. Check log file:

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

[System] [MY-010116] [Server] \local\mysql\bin\mysqld
   (mysqld 8.0.16) starting as process 3948

[Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.

[System] [MY-010931] [Server] \local\mysql\bin\mysqld: ready for
   connections. Version: '8.0.16'  socket: ''  port: 3306  MySQL
   Community Server - GPL.

[System] [MY-011323] [Server] X Plugin ready for connections.
   Bind-address: '::' port: 33060

7. Verify MySQL server with the client tool:

herong> \local\mysql\bin\mysql -u root

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.16 MySQL Community Server - GPL

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
...

Cool. MySQL Server is up and running. You can access it as "root" with no password!

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

 References

 Full Version in PDF/EPUB