1MYSQL_INSTALL_DB() MYSQL_INSTALL_DB()
2
3
4
6 mysql_install_db - initialize MySQL data directory
7
9 mysql_install_db [options]
10
12 mysql_install_db initializes the MySQL data directory and creates the
13 system tables that it contains, if they do not exist. mysql_install_db
14 is a shell script and is available only on Unix platforms.
15
16 To invoke mysql_install_db, use the following syntax:
17
18 shell> mysql_install_db [options]
19
20 Because the MySQL server, mysqld, needs to access the data directory
21 when it runs later, you should either run mysql_install_db from the
22 same system account that will be used for running mysqld or run it as
23 root and use the --user option to indicate the user name that mysqld
24 will run as. It might be necessary to specify other options such as
25 --basedir or --datadir if mysql_install_db does not use the correct
26 locations for the installation directory or data directory. For
27 example:
28
29 shell> bin/mysql_install_db --user=mysql \
30 --basedir=/opt/mysql/mysql \
31 --datadir=/opt/mysql/mysql/data
32
33 mysql_install_db needs to invoke mysqld with the --bootstrap and
34 --skip-grant-tables options. If MySQL was configured with the
35 --disable-grant-options option, --bootstrap and --skip-grant-tables
36 will be disabled (see Section 2.11.4, “MySQL Source-Configuration
37 Options”). To handle this, set the MYSQLD_BOOTSTRAP environment
38 variable to the full path name of a server that has all options
39 enabled. mysql_install_db will use that server.
40
41 Note
42 If you have set a custom TMPDIR environment variable when
43 performing the installation, and the specified directory is not
44 accessible, mysql_install_db may fail. If so, unset TMPDIR or set
45 TMPDIR to point to the system temporary directory (usually /tmp).
46
47 mysql_install_db supports the following options, which can be specified
48 on the command line or in the [mysql_install_db] group of an option
49 file. (Options that are common to mysqld can also be specified in the
50 [mysqld] group.) Other options are passed to mysqld. For information
51 about option files, see Section 4.2.3.3, “Using Option Files”.
52 mysql_install_db also supports the options for processing option files
53 described at Section 4.2.3.4, “Command-Line Options that Affect Option-
54 File Handling”.
55
56 · --basedir=path
57
58 The path to the MySQL installation directory.
59
60 · --datadir=path, --ldata=path
61
62 The path to the MySQL data directory.
63
64 · --force
65
66 Cause mysql_install_db to run even if DNS does not work. Grant
67 table entries that normally use host names will use IP addresses.
68
69 · --rpm
70
71 For internal use. This option is used during the MySQL installation
72 process for install operations performed using RPM packages.
73
74 · --skip-name-resolve
75
76 Use IP addresses rather than host names when creating grant table
77 entries. This option can be useful if your DNS does not work.
78
79 · --srcdir=path
80
81 For internal use. This option specifies the directory under which
82 mysql_install_db looks for support files such as the error message
83 file and the file for populating the help tables. This option was
84 added in MySQL 5.1.14.
85
86 · --user=user_name
87
88 The system (login) user name to use for running mysqld. Files and
89 directories created by mysqld will be owned by this user. You must
90 be root to use this option. By default, mysqld runs using your
91 current login name and files and directories that it creates will
92 be owned by you.
93
94 · --verbose
95
96 Verbose mode. Print more information about what the program does.
97
98 · --windows
99
100 For internal use. This option is used for creating Windows
101 distributions.
102
104 Copyright © 1997, 2013, Oracle and/or its affiliates. All rights
105 reserved.
106
107 This documentation is free software; you can redistribute it and/or
108 modify it only under the terms of the GNU General Public License as
109 published by the Free Software Foundation; version 2 of the License.
110
111 This documentation is distributed in the hope that it will be useful,
112 but WITHOUT ANY WARRANTY; without even the implied warranty of
113 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
114 General Public License for more details.
115
116 You should have received a copy of the GNU General Public License along
117 with the program; if not, write to the Free Software Foundation, Inc.,
118 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
119 http://www.gnu.org/licenses/.
120
121
123 For more information, please refer to the MySQL Reference Manual, which
124 may already be installed locally and which is also available online at
125 http://dev.mysql.com/doc/.
126
128 Oracle Corporation (http://dev.mysql.com/).
129
130
131
132 MYSQL_INSTALL_DB()