mysqld - The MySQL Server Program

A quick introduction on the MySQL server daemon program, 'mysqld'. If MySQL service is installed as a Windows service, there is no need to run 'mysqld' directly.

What Is mysqld? mysqld is the MySQL server daemon program. The syntax to run mysqld is given below, assuming that the "%mysql%" environment variable has been defined to represent the MySQL Server directory.

herong> %mysql%\bin\mysqld [OPTIONS]

mysqld version 8.0 supports a huge list of options. You can get a list of supported options by running the "mysqld --help --verbose" command:

herong> %mysql%\bin\mysqld --help --verbose

mysqld  Ver 8.0.16 for Win64 on x86_64 (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.

Starts the MySQL database server.

Usage: mysqld [OPTIONS]
NT and Win32 specific options:
  --install
                Install the default service (NT).
  --install-manual
                Install the default service started manually (NT).
  --install service_name
                Install an optional service (NT).
  --install-manual service_name
                Install an optional service started manually (NT).
  --remove
                Remove the default service from the service list (NT).
  --remove service_name
                Remove the service_name from the service list (NT).
  --enable-named-pipe
                Only to be used for the default server (NT).
  --standalone
                Dummy option to start as a standalone server (NT).

Default options are read from the following files in the given order:
  C:\Windows\my.ini
  C:\Windows\my.cnf C:\my.ini
  C:\my.cnf
  C:\Program Files\MySQL\MySQL Server 8.0\my.ini
  C:\Program Files\MySQL\MySQL Server 8.0\my.cnf

The following groups are read: mysqld server mysqld-8.0
The following options may be given as the first argument:
--print-defaults     Print the program argument list and exit.
--no-defaults        Don't read default options from any option file,
                     except for login file.
--defaults-file=#    Only read default options from the given file #.
--defaults-extra-file=# Read this file after global files are read.
--defaults-group-suffix=#
                     Also read groups with concat(group, suffix)
--login-path=#       Read this path from the login file.
...

Variables (--variable-name=value)
and boolean options {FALSE|TRUE}   Value (after reading options)
---------------------------------- -------------
abort-slave-event-count            0
allow-suspicious-udfs              FALSE
archive                            ON
auto-increment-increment           1
auto-increment-offset              1
autocommit                         TRUE
automatic-sp-privileges            TRUE
avoid-temporal-upgrade             FALSE
back-log                           80
basedir                       C:\Program Files\MySQL\MySQL Server 8.0\
...
To see what values a running MySQL server is using, type
'mysqladmin variables' instead of 'mysqld --verbose --help'.

Since MySQL 8.0 Server is controlled by the Windows service "MySQL80", there is no need to run "mysqld" program directly start/stop the the server. But you can use it to:

%mysql%\bin\mysqld --install
   To create a Windows service for MySQL Server manually.

%mysql%\bin\mysqld --remove
   To remove the Windows service that controls MySQL Server.

%mysql%\bin\mysqld --initialize
   To initialize a new server data directory for new Server instance.

If you are having trouble to setup or run Windows service "MYSQL80", you can still run "mysqld" program directly as shown below:

rem Start MySQL Server with default options on a given data directory
rem You may need to run this with "administrator" permission
herong> %mysql%bin\mysqld.exe \
   --datadir="C:\ProgramData\MySQL\MySQL Server 8.0\Data"

rem Start MySQL Server with options given in a *.ini file
herong> %mysql%\bin\mysqld.exe \
   --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" MySQL80

Table of Contents

 About This Book

 Introduction of SQL

 MySQL Introduction and Installation

Introduction of MySQL Programs

 List of MySQL Programs

mysqld - The MySQL Server Program

 mysqladmin - The Client Tool for Administrators

 mysql - The Client Tool for End Users

 Using "mysql" Command to Run SQL Statements

 mysqldump - Dumping Data to Files

 --secure-file-priv="" - MySQL Server Option

 mysqlimport - Loading Data from Files

 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