mysql_install_db
— Initialize MySQL Data Directory
258
On Windows systems, MySQL distributions include a
mysql_fix_privilege_tables.sql
SQL
script that you can run using the
mysql
client. For example, if your MySQL installation is located at
C:
\Program Files\MySQL\MySQL Server 5.0
, the commands look like this:
C:\>
cd "C:\Program Files\MySQL\MySQL Server 5.0"
C:\>
bin\mysql -u root -p mysql
mysql>
SOURCE share/mysql_fix_privilege_tables.sql
Note
Prior to version 5.0.38, this script is found in the
scripts
directory.
The
mysql
command will prompt you for the
root
password; enter it when prompted.
If your installation is located in some other directory, adjust the path names appropriately.
As with the Unix procedure, you might see some
Duplicate column name
warnings as
mysql
processes the statements in the
mysql_fix_privilege_tables.sql
script; you can ignore them.
After running the script, stop the server and restart it.
4.4.6.
mysql_install_db
— Initialize MySQL Data Directory
mysql_install_db
initializes the MySQL data directory and creates the system tables that it
contains, if they do not exist.
mysql_install_db
is a shell script and is available only on Unix
platforms.
To invoke
mysql_install_db
, use the following syntax:
shell>
mysql_install_db [options]
Because the MySQL server,
mysqld
, needs to access the data directory when it runs later, you should
either run
mysql_install_db
from the same system account that will be used for running
mysqld
or run it as
root
and use the
--user
[259]
option to indicate the user name that
mysqld
will run
as. It might be necessary to specify other options such as
--basedir
[258]
or
--datadir
[258]
if
mysql_install_db
does not use the correct locations for the installation directory or data directory.
For example:
shell>
bin/mysql_install_db --user=mysql \
--basedir=/opt/mysql/mysql \
--datadir=/opt/mysql/mysql/data
mysql_install_db
needs to invoke
mysqld
with the
--bootstrap
[402]
and
--skip-
grant-tables
[420]
options. If MySQL was configured with the
--disable-grant-
options
[123]
configuration option,
--bootstrap
[402]
and
--skip-grant-tables
[420]
will be disabled (see
Section 2.17.3, “MySQL Source-Configuration Options”
). To handle this, set
the
MYSQLD_BOOTSTRAP
environment variable to the full path name of a server that has all options
enabled.
mysql_install_db
will use that server.
mysql_install_db
supports the following options, which can be specified on the command line or in
the
[mysql_install_db]
group of an option file. (Options that are common to
mysqld
can also be
specified in the
[mysqld]
group.) Other options are passed to
mysqld
. For information about option
files, see
Section 4.2.3.3, “Using Option Files”
.
mysql_install_db
also supports the options for
processing option files described at
Section 4.2.3.4, “Command-Line Options that Affect Option-File
Handling”
.
•
--basedir=path
[258]
The path to the MySQL installation directory.
•
--datadir=path
[258]
,
--ldata=path
[258]
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...