The mysql_install_db script creates the server's data directory, initializes the mysql database that contains the grant tables, and creates an empty test database. mysql_install_db populates the grant tables with initial accounts for the root and anonymous users. See Chapter 11 for details on these accounts and how to secure your installation by establishing passwords.
mysql_install_db is a shell script and is unavailable on Windows. However, it is unnecessary on Windows, because distributions include the mysql and test databases preinitialized.
The version numbers mentioned in this section indicate when you can first use the options on the command line, but you can set the values for many of them in earlier versions by placing appropriate entries in the [mysqld] group of the global option file. As of MySQL 3.23.39, the script also reads the [mysql_install_db] option group, which is more useful for options, such as --ldata and --force, that are understood only by mysql_install_db and not mysqld.
Use this directory as the MySQL base directory.
Use this directory as the MySQL data directory. The --datadir option was introduced in MySQL 3.23.17 and --ldata in MySQL 3.23.24.
Run even if the current hostname cannot be determined. (The IP number of the host will be used to create grant table entries instead, which means you'll need to use the IP number rather than the hostname except for connections to localhost.) This option was introduced in MySQL 3.22.17.
Run the server as the named user. This is useful for making sure that any directories and files created by the server are owned by this user if you run the script as the UNIX root user. This option was introduced in MySQL 3.23.17.