Team LiB
Previous Section Next Section


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, "General MySQL Administration," for details on these accounts and how to secure your installation by establishing passwords.

mysql_install_db is unavailable on Windows, but unnecessary because Windows distributions include preinitialized mysql and test databases.


mysql_install_db [options]

Options Specific to mysql_install_db

You can use the options mentioned in this section on the command line, and you can set the values for many of them by placing appropriate entries in the [mysqld] group of an option file. 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 by mysqld.

  • --basedir=dir_name

    The pathname to the MySQL base directory.

  • --datadir=dir_name, --ldata=dir_name

    The pathname to the MySQL data directory.

  • --force

    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.)

  • --skip-name-resolve

    Use only IP addresses in the grant tables rather than hostnames. This option might be necessary if you don't have a working DNS server.

  • --user=user_name

    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 mysql_install_db as the Unix root user.

    Team LiB
    Previous Section Next Section