mysql5/mysql-5.7.27/man/mysql_install_db.1

1664 lines
34 KiB
Groff

'\" t
.\" Title: \fBmysql_install_db\fR
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 06/08/2019
.\" Manual: MySQL Database System
.\" Source: MySQL 5.7
.\" Language: English
.\"
.TH "\FBMYSQL_INSTALL_DB\FR" "1" "06/08/2019" "MySQL 5\&.7" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
mysql_install_db \- initialize MySQL data directory
.SH "SYNOPSIS"
.HP \w'\fBmysql_install_db\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u
\fBmysql_install_db [\fR\fB\fIoptions\fR\fR\fB]\fR
.SH "DESCRIPTION"
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
\fBmysql_install_db\fR
is deprecated as of MySQL 5\&.7\&.6 because its functionality has been integrated into
\fBmysqld\fR, the MySQL server\&. To initialize a MySQL installation, invoke
\fBmysqld\fR
with the
\fB\-\-initialize\fR
or
\fB\-\-initialize\-insecure\fR
option\&. For more information, see
Section\ \&2.10.1, \(lqInitializing the Data Directory\(rq\&.
\fBmysql_install_db\fR
will be removed in a future MySQL release\&.
.sp .5v
.RE
.PP
\fBmysql_install_db\fR
handles initialization tasks that must be performed before the MySQL server,
\fBmysqld\fR, is ready to use:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
It initializes the MySQL data directory and creates the system tables that it contains\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
It initializes the
system tablespace
and related data structures needed to manage
InnoDB
tables\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
It loads the server\-side help tables\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
It installs the
sys
schema\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
It creates an administrative account\&. Older versions of
\fBmysql_install_db\fR
may create anonymous\-user accounts\&.
.RE
.PP
Before MySQL 5\&.7\&.5,
\fBmysql_install_db\fR
is a Perl script and requires that Perl be installed\&. As of 5\&.7\&.5,
\fBmysql_install_db\fR
is written in C++ and supplied in binary distributions as an executable binary\&. In addition, a number of new options were added and old options removed\&. If you find that an option does not work as you expect, be sure to check which options apply in your version of
\fBmysql_install_db\fR
(invoke it with the
\fB\-\-help\fR
option)\&.
Secure\-by\-Default Deployment.PP
Current versions of
\fBmysql_install_db\fR
produce a MySQL deployment that is secure by default\&. It is recommended that you use
\fBmysql_install_db\fR
from MySQL 5\&.7\&.5 or up for best security, but version\-dependent information about security characteristics is included here for completeness (secure\-by\-default deployment was introduced in stages in MySQL 5\&.7)\&.
.PP
MySQL 5\&.7\&.5 and up is secure by default, with these characteristics:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A single administrative account named
\*(Aqroot\*(Aq@\*(Aqlocalhost\*(Aq
is created with a randomly generated password, which is marked expired\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
No anonymous\-user accounts are created\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
No
test
database accessible by all users is created\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-admin\-\fR\fB\fIxxx\fR\fR
options are available to control characteristics of the administrative account\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The
\fB\-\-random\-password\-file\fR
option is available to control where the random password is written\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The
\fB\-\-insecure\fR
option is available to suppress random password generation\&.
.RE
.PP
MySQL 5\&.7\&.4 is secure by default, with these characteristics:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A single administrative account named
\*(Aqroot\*(Aq@\*(Aqlocalhost\*(Aq
is created with a randomly generated password, which is marked expired\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
No anonymous\-user accounts are created\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
No
test
database accessible by all users is created\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The
\fB\-\-skip\-random\-passwords\fR
option is available to suppress random password generation, and to create a
test
database\&.
.RE
.PP
MySQL 5\&.7\&.3 and earlier are not secure by default, with these characteristics:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Multiple administrative
root
accounts are created with no password\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Anonymous\-user accounts are created\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A
test
database accessible by all users is created\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The
\fB\-\-random\-passwords\fR
option is available to generate random passwords for administrative accounts and mark them expired, and to not create anonymous\-user accounts\&.
.RE
.PP
If
\fBmysql_install_db\fR
generates a random administative password, it writes the password to a file and displays the file name\&. The password entry includes a timestamp to indicate when it was written\&. By default, the file is
\&.mysql_secret
in the home directory of the effective user running the script\&.
\&.mysql_secret
is created with mode 600 to be accessible only to the operating system user for whom it is created\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBImportant\fR
.ps -1
.br
.PP
When
\fBmysql_install_db\fR
generates a random password for the administrative account, it is necessary after
\fBmysql_install_db\fR
has been run to start the server, connect using the administrative account with the password written to the
\&.mysql_secret
file, and specify a new administrative password\&. Until this is done, the administrative account cannot be used for anything else\&. To change the password, you can use the
SET PASSWORD
statement (for example, with the
\fBmysql\fR
or
\fBmysqladmin\fR
client)\&. After resetting the password, remove the
\&.mysql_secret
file; otherwise, if you run
\fBmysql_secure_installation\fR, that command may see the file and expire the
root
password again as part of ensuring secure deployment\&.
.sp .5v
.RE
Invocation Syntax.PP
Several changes to
\fBmysql_install_db\fR
were made in MySQL 5\&.7\&.5 that affect the invocation syntax\&. Change location to the MySQL installation directory and use the command appropriate to your version of MySQL:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Invocation syntax for MySQL 5\&.7\&.5 and up:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBbin/mysql_install_db \-\-datadir=\fR\fB\fIpath/to/datadir\fR\fR\fB [\fR\fB\fIother_options\fR\fR\fB]\fR
.fi
.if n \{\
.RE
.\}
.sp
The
\fB\-\-datadir\fR
option is mandatory\&.
\fBmysql_install_db\fR
creates the data directory, which must not already exist:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
If the data directory does already exist, you are performing an upgrade operation (not an install operation) and should run
\fBmysql_upgrade\fR, not
\fBmysql_install_db\fR\&. See
\fBmysql_upgrade\fR(1)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
If the data directory does not exist but
\fBmysql_install_db\fR
fails, you must remove any partially created data directory before running
\fBmysql_install_db\fR
again\&.
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Invocation syntax before MySQL 5\&.7\&.5:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBscripts/mysql_install_db [\fR\fB\fIoptions\fR\fR\fB]\fR
.fi
.if n \{\
.RE
.\}
.RE
.PP
Because the MySQL server,
\fBmysqld\fR, must access the data directory when it runs later, you should either run
\fBmysql_install_db\fR
from the same system account that will be used for running
\fBmysqld\fR, or run it as
root
and specify the
\fB\-\-user\fR
option to indicate the user name that
\fBmysqld\fR
will run as\&. It might be necessary to specify other options such as
\fB\-\-basedir\fR
if
\fBmysql_install_db\fR
does not use the correct location for the installation directory\&. For example:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBbin/mysql_install_db \-\-user=mysql \e\fR
\fB\-\-basedir=/opt/mysql/mysql \e\fR
\fB\-\-datadir=/opt/mysql/mysql/data\fR
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
After
\fBmysql_install_db\fR
sets up the
InnoDB
system tablespace, changes to some tablespace characteristics require setting up a whole new
instance\&. This includes the file name of the first file in the system tablespace and the number of undo logs\&. If you do not want to use the default values, make sure that the settings for the
innodb_data_file_path
and
innodb_log_file_size
configuration parameters are in place in the MySQL
configuration file
before running
\fBmysql_install_db\fR\&. Also make sure to specify as necessary other parameters that affect the creation and location of
InnoDB
files, such as
innodb_data_home_dir
and
innodb_log_group_home_dir\&.
.PP
If those options are in your configuration file but that file is not in a location that MySQL reads by default, specify the file location using the
\fB\-\-defaults\-extra\-file\fR
option when you run
\fBmysql_install_db\fR\&.
.sp .5v
.RE
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
If you have set a custom
TMPDIR
environment variable when performing the installation, and the specified directory is not accessible,
\fBmysql_install_db\fR
may fail\&. If so, unset
TMPDIR
or set
TMPDIR
to point to the system temporary directory (usually
/tmp)\&.
.sp .5v
.RE
Administrative Account Creation.PP
\fBmysql_install_db\fR
creates an administrative account named
\*(Aqroot\*(Aq@\*(Aqlocalhost\*(Aq
by default\&. (Before MySQL 5\&.7\&.4,
\fBmysql_install_db\fR
creates additional
root
accounts, such as
\*(Aqroot\*(Aq@\*(Aq127\&.0\&.0\&.1\*(Aq\&. This is no longer done\&.)
.PP
As of MySQL 5\&.7\&.5,
\fBmysql_install_db\fR
provides options that enable you to control several aspects of the administrative account:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
To change the user or host parts of the account name, use
\fB\-\-login\-path\fR, or
\fB\-\-admin\-user\fR
and
\fB\-\-admin\-host\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-insecure\fR
suppresses generation of a random password\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-admin\-auth\-plugin\fR
specifies the authentication plugin\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-admin\-require\-ssl\fR
specifies whether the account must use SSL connections\&.
.RE
.PP
For more information, see the descriptions of those options\&.
.PP
\fBmysql_install_db\fR
assigns
mysql\&.user
system table rows a nonempty
plugin
column value to set the authentication plugin\&. The default value is
mysql_native_password\&. The value can be changed using the
\fB\-\-admin\-auth\-plugin\fR
option in MySQL 5\&.7\&.5 and up (as noted previously), or by setting the
default_authentication_plugin
system variable in MySQL 5\&.7\&.2 to 5\&.7\&.4\&.
Default my\&.cnf File.PP
As of MySQL 5\&.7\&.5,
\fBmysql_install_db\fR
creates no default
my\&.cnf
file\&.
.PP
Before MySQL 5\&.7\&.5,
\fBmysql_install_db\fR
creates a default option file named
my\&.cnf
in the base installation directory\&. This file is created from a template included in the distribution package named
my\-default\&.cnf\&. You can find the template in or under the base installation directory\&. When started using
\fBmysqld_safe\fR, the server uses
my\&.cnf
file by default\&. If
my\&.cnf
already exists,
\fBmysql_install_db\fR
assumes it to be in use and writes a new file named
my\-new\&.cnf
instead\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
As of MySQL 5\&.7\&.18,
my\-default\&.cnf
is no longer included in or installed by distribution packages\&.
.sp .5v
.RE
.PP
With one exception, the settings in the default option file are commented and have no effect\&. The exception is that the file sets the
sql_mode
system variable to
NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES\&. This setting produces a server configuration that results in errors rather than warnings for bad data in operations that modify transactional tables\&. See
Section\ \&5.1.10, \(lqServer SQL Modes\(rq\&.
Command Options.PP
\fBmysql_install_db\fR
supports the following options, which can be specified on the command line or in the
[mysql_install_db]
group of an option file\&. For information about option files used by MySQL programs, see
Section\ \&4.2.2.2, \(lqUsing Option Files\(rq\&.
.PP
Before MySQL 5\&.7\&.5,
\fBmysql_install_db\fR
passes unrecognized options to
\fBmysqld\fR\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-help\fR,
\fB\-?\fR
.sp
Display a help message and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-admin\-auth\-plugin=\fR\fB\fIplugin_name\fR\fR
.sp
The authentication plugin to use for the administrative account\&. The default is
mysql_native_password\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-admin\-host=\fR\fB\fIhost_name\fR\fR
.sp
The host part to use for the adminstrative account name\&. The default is
localhost\&. This option is ignored if
\fB\-\-login\-path\fR
is also specified\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-admin\-require\-ssl\fR
.sp
Whether to require SSL for the administrative account\&. The default is not to require it\&. With this option enabled, the statement that
\fBmysql_install_db\fR
uses to create the account includes a
REQUIRE SSL
clause\&. As a result, the administrative account must use secure connections when connecting to the server\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-admin\-user=\fR\fB\fIuser_name\fR\fR
.sp
The user part to use for the adminstrative account name\&. The default is
root\&. This option is ignored if
\fB\-\-login\-path\fR
is also specified\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-basedir=\fR\fB\fIdir_name\fR\fR
.sp
The path to the MySQL installation directory\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-builddir=\fR\fB\fIdir_name\fR\fR
.sp
For use with
\fB\-\-srcdir\fR
and out\-of\-source builds\&. Set this to the location of the directory where the built files reside\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-cross\-bootstrap\fR
.sp
For internal use\&. This option is used for building system tables on one host intended for another\&.
.sp
This option was removed in MySQL 5\&.7\&.5\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-datadir=\fR\fB\fIdir_name\fR\fR
.sp
The path to the MySQL data directory\&. Only the last component of the path name is created if it does not exist; the parent directory must already exist or an error occurs\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
As of MySQL 5\&.7\&.5, the
\fB\-\-datadir\fR
option is mandatory and the data directory must not already exist\&. (It remains true that the parent directory must exist\&.)
.sp .5v
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-defaults\fR
.sp
This option causes
\fBmysql_install_db\fR
to invoke
\fBmysqld\fR
in such a way that it reads option files from the default locations\&. If given as
\fB\-\-no\-defaults\fR, and
\fB\-\-defaults\-file\fR
or
\fB\-\-defaults\-extra\-file\fR
is not also specified,
\fBmysql_install_db\fR
passes
\fB\-\-no\-defaults\fR
to
\fBmysqld\fR, to prevent option files from being read\&. This may help if program startup fails due to reading unknown options from an option file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR
.sp
Read this option file after the global option file but (on Unix) before the user option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&.
\fIfile_name\fR
is interpreted relative to the current directory if given as a relative path name rather than a full path name\&.
.sp
This option is passed by
\fBmysql_install_db\fR
to
\fBmysqld\fR\&.
.sp
For additional information about this and other option\-file options, see
Section\ \&4.2.2.3, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR
.sp
Use only the given option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&.
\fIfile_name\fR
is interpreted relative to the current directory if given as a relative path name rather than a full path name\&.
.sp
This option is passed by
\fBmysql_install_db\fR
to
\fBmysqld\fR\&.
.sp
For additional information about this and other option\-file options, see
Section\ \&4.2.2.3, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-extra\-sql\-file=\fR\fB\fIfile_name\fR\fR,
\fB\-f \fR\fB\fIfile_name\fR\fR
.sp
This option names a file containing additional SQL statements to be executed after the standard bootstrapping statements\&. Accepted statement syntax in the file is like that of the
\fBmysql\fR
command\-line client, including support for multiple\-line C\-style comments and delimiter handling to enable definition of stored programs\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-force\fR
.sp
Cause
\fBmysql_install_db\fR
to run even if DNS does not work\&. Grant table entries normally created using host names will use IP addresses instead\&.
.sp
This option was removed in MySQL 5\&.7\&.5\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-insecure\fR
.sp
Do not generate a random password for the adminstrative account\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
The
\fB\-\-insecure\fR
option was added in MySQL 5\&.7\&.5, replacing the
\fB\-\-skip\-random\-passwords\fR
option\&.
.sp .5v
.RE
If
\fB\-\-insecure\fR
is
\fInot\fR
given, it is necessary after
\fBmysql_install_db\fR
has been run to start the server, connect using the administrative account with the password written to the
\&.mysql_secret
file, and specify a new administrative password\&. Until this is done, the administrative account cannot be used for anything else\&. To change the password, you can use the
SET PASSWORD
statement (for example, with the
\fBmysql\fR
or
\fBmysqladmin\fR
client)\&. After resetting the password, remove the
\&.mysql_secret
file; otherwise, if you run
\fBmysql_secure_installation\fR, that command may see the file and expire the
root
password again as part of ensuring secure deployment\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-keep\-my\-cnf\fR
.sp
Tell
\fBmysql_install_db\fR
to preserve any existing
my\&.cnf
file and not create a new default
my\&.cnf
file\&.
.sp
This option was added in MySQL 5\&.7\&.4 and removed in 5\&.7\&.5\&. As of 5\&.7\&.5,
\fBmysql_install_db\fR
does not create a default
my\&.cnf
file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-lc\-messages=name\fR
.sp
The locale to use for error messages\&. The default is
en_US\&. The argument is converted to a language name and combined with the value of
\fB\-\-lc\-messages\-dir\fR
to produce the location for the error message file\&. See
Section\ \&10.11, \(lqSetting the Error Message Language\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-lc\-messages\-dir=\fR\fB\fIdir_name\fR\fR
.sp
The directory where error messages are located\&. The value is used together with the value of
\fB\-\-lc\-messages\fR
to produce the location for the error message file\&. See
Section\ \&10.11, \(lqSetting the Error Message Language\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-ldata=\fR\fB\fIdir_name\fR\fR
.sp
A synonym for
\fB\-\-datadir\fR\&.
.sp
This option was removed in MySQL 5\&.7\&.5\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-login\-file=\fR\fB\fIfile_name\fR\fR
.sp
The file from which to read the login path if the
\fB\-\-login\-path=\fR\fB\fIfile_name\fR\fR
option is specified\&. The default file is
\&.mylogin\&.cnf\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-login\-path=\fR\fB\fIname\fR\fR
.sp
Read options from the named login path in the
\&.mylogin\&.cnf
login path file\&. The default login path is
client\&. (To read a different file, use the
\fB\-\-login\-file=\fR\fB\fIname\fR\fR
option\&.) A
\(lqlogin path\(rq
is an option group containing options that specify which MySQL server to connect to and which account to authenticate as\&. To create or modify a login path file, use the
\fBmysql_config_editor\fR
utility\&. See
\fBmysql_config_editor\fR(1)\&.
.sp
If the
\fB\-\-login\-path\fR
option is specified, the user, host, and password values are taken from the login path and used to create the administrative account\&. The password must be defined in the login path or an error occurs, unless the
\fB\-\-insecure\fR
option is also specified\&. In addition, with
\fB\-\-login\-path\fR, any
\fB\-\-admin\-host\fR
and
\fB\-\-admin\-user\fR
options are ignored\&.
.sp
For additional information about this and other option\-file options, see
Section\ \&4.2.2.3, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-mysqld\-file=\fR\fB\fIfile_name\fR\fR
.sp
The path name of the
\fBmysqld\fR
binary to execute\&. The option value must be an absolute path name or an error occurs\&.
.sp
If this option is not given,
\fBmysql_install_db\fR
searches for
\fBmysqld\fR
in these locations:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
In the
bin
directory under the
\fB\-\-basedir\fR
option value, if that option was given\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
In the
bin
directory under the
\fB\-\-srcdir\fR
option value, if that option was given\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
In the
bin
directory under the
\fB\-\-builddir\fR
option value, if that option was given\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
In the local directory and in the
bin
and
sbin
directories under the local directory\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
In
/usr/bin,
/usr/sbin,
/usr/local/bin,
/usr/local/sbin,
/opt/local/bin,
/opt/local/sbin\&.
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-no\-defaults\fR
.sp
Before MySQL 5\&.7\&.5, do not read any option files\&. If program startup fails due to reading unknown options from an option file,
\fB\-\-no\-defaults\fR
can be used to prevent them from being read\&. For behavior of this option as of MySQL 5\&.7\&.5, see the description of
\fB\-\-defaults\fR\&.
.sp
For additional information about this and other option\-file options, see
Section\ \&4.2.2.3, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-random\-password\-file=\fR\fB\fIfile_name\fR\fR
.sp
The path name of the file in which to write the randomly generated password for the administrative account\&. The option value must be an absolute path name or an error occurs\&. The default is
$HOME/\&.mysql_secret\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-random\-passwords\fR
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
This option was removed in MySQL 5\&.7\&.4 and replaced with
\fB\-\-skip\-random\-passwords\fR, which was in turn removed in MySQL 5\&.7\&.5 and replaced with
\fB\-\-insecure\fR\&.
.sp .5v
.RE
On Unix platforms, this option provides for more secure MySQL installation\&. Invoking
\fBmysql_install_db\fR
with
\fB\-\-random\-passwords\fR
causes it to perform the following actions in addition to its normal operation:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The installation process creates a random password, assigns it to the initial MySQL
root
accounts, and marks the password expired for those accounts\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The initial random
root
password is written to the
\&.mysql_secret
file in the directory named by the
HOME
environment variable\&. Depending on operating system, using a command such as
\fBsudo\fR
may cause the value of
HOME
to refer to the home directory of the
root
system user\&.
\&.mysql_secret
is created with mode 600 to be accessible only to the operating system user for whom it is created\&.
.sp
If
\&.mysql_secret
already exists, the new password information is appended to it\&. Each password entry includes a timestamp to indicate when it was written\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
No anonymous\-user MySQL accounts are created\&.
.RE
.sp
As a result of these actions, it is necessary after installation to start the server, connect as
root
using the password written to the
\&.mysql_secret
file, and specify a new
root
password\&. Until this is done,
root
cannot do anything else\&. This must be done for each
root
account you intend to use\&. To change the password, you can use the
SET PASSWORD
statement (for example, with the
\fBmysql\fR
client)\&. You can also use
\fBmysqladmin\fR
or
\fBmysql_secure_installation\fR\&.
.sp
New install operations (not upgrades) using RPM packages and Solaris PKG packages invoke
\fBmysql_install_db\fR
with the
\fB\-\-random\-passwords\fR
option\&. (Install operations using RPMs for Unbreakable Linux Network are unaffected because they do not use
\fBmysql_install_db\fR\&.)
.sp
For install operations using a binary
\&.tar\&.gz
distribution or a source distribution, you can invoke
\fBmysql_install_db\fR
with the
\fB\-\-random\-passwords\fR
option manually to make your MySQL installation more secure\&. This is recommended, particularly for sites with sensitive data\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-rpm\fR
.sp
For internal use\&. This option is used during the MySQL installation process for install operations performed using RPM packages\&.
.sp
This option was removed in MySQL 5\&.7\&.5\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-skip\-name\-resolve\fR
.sp
Use IP addresses rather than host names when creating grant table entries\&. This option can be useful if your DNS does not work\&.
.sp
This option was removed in MySQL 5\&.7\&.5\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-skip\-random\-passwords\fR
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
The
\fB\-\-skip\-random\-passwords\fR
option was added in MySQL 5\&.7\&.4, replacing the
\fB\-\-random\-passwords\fR
option\&.
\fB\-\-skip\-random\-passwords\fR
was in turn removed in MySQL 5\&.7\&.5 and replaced with
\fB\-\-insecure\fR\&.
.sp .5v
.RE
As of MySQL 5\&.7\&.4, MySQL deployments produced using
\fBmysql_install_db\fR
are secure by default\&. When invoked
\fIwithout\fR
the
\fB\-\-skip\-random\-passwords\fR
option,
\fBmysql_install_db\fR
uses these default deployment characteristics:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The installation process creates a single
root
account,
\*(Aqroot\*(Aq@\*(Aqlocalhost\*(Aq, automatically generates a random password for this account, and marks the password expired\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The initial random
root
password is written to the
\&.mysql_secret
file in the home directory of the effective user running the script\&.
\&.mysql_secret
is created with mode 600 to be accessible only to the operating system user for whom it is created\&.
.sp
If
\&.mysql_secret
already exists, the new password information is appended to it\&. Each password entry includes a timestamp to indicate when it was written\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
No anonymous\-user MySQL accounts are created\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
No
test
database is created\&.
.RE
.sp
As a result of these actions, it is necessary after installation to start the server, connect as
root
using the password written to the
\&.mysql_secret
file, and specify a new
root
password\&. Until this is done, the administrative account cannot be used for anything else\&. To change the password, you can use the
SET PASSWORD
statement (for example, with the
\fBmysql\fR
client)\&. You can also use
\fBmysqladmin\fR
or
\fBmysql_secure_installation\fR\&.
.sp
To produce a MySQL deployment that is not secure by default, you must explicitly specify the
\fB\-\-skip\-random\-passwords\fR
option when you invoke
\fBmysql_install_db\fR\&. With this option,
\fBmysql_install_db\fR
performs the following actions:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
No random password is generated for the
\*(Aqroot\*(Aq@\*(Aqlocalhost\*(Aq
account\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A
test
database is created that is accessible by any user\&.
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-skip\-sys\-schema\fR
.sp
As of MySQL 5\&.7\&.7,
\fBmysql_install_db\fR
installs the
sys
schema\&. The
\fB\-\-skip\-sys\-schema\fR
option suppresses this behavior\&. This option was added in MySQL 5\&.7\&.7\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-srcdir=\fR\fB\fIdir_name\fR\fR
.sp
For internal use\&. This option specifies the directory under which
\fBmysql_install_db\fR
looks for support files such as the error message file and the file for populating the help tables\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-user=\fR\fB\fIuser_name\fR\fR,
\fB\-u \fR\fB\fIuser_name\fR\fR
.sp
The system (login) user name to use for running
\fBmysqld\fR\&. Files and directories created by
\fBmysqld\fR
will be owned by this user\&. You must be the system
root
user to use this option\&. By default,
\fBmysqld\fR
runs using your current login name and files and directories that it creates will be owned by you\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-verbose\fR,
\fB\-v\fR
.sp
Verbose mode\&. Print more information about what the program does\&. You can use this option to see the
\fBmysqld\fR
command that
\fBmysql_install_db\fR
invokes to start the server in bootstrap mode\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-version\fR,
\fB\-V\fR
.sp
Display version information and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-windows\fR
.sp
For internal use\&. This option is used for creating Windows distributions\&. It is a deprecated alias for
\fB\-\-cross\-bootstrap\fR
.sp
This option was removed in MySQL 5\&.7\&.5\&.
.RE
.SH "COPYRIGHT"
.br
.PP
Copyright \(co 1997, 2019, Oracle and/or its affiliates. All rights reserved.
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
.sp
.SH "SEE ALSO"
For more information, please refer to the MySQL Reference Manual,
which may already be installed locally and which is also available
online at http://dev.mysql.com/doc/.
.SH AUTHOR
Oracle Corporation (http://dev.mysql.com/).