Installing system tables (mysql_install_db)

You are viewing an old version of this article. View the current version here.

mysql_install_db is needed to create the system tables in the 'mysql' database directory that MariaDB uses to manage user rights and provide the 'help' command.

The normal usage of it is:

mysql_install_db --user=mysql

Here is a list of the options mysql_install_db supports:

--basedir=pathThe path to the MariaDB installation directory.
--builddir=pathIf using --srcdir with out-of-directory builds, you will need to set this to the location of the build directory where built files reside.
--cross-bootstrapFor internal use. Used when building the MariaDB system tables on a different host than the target.
--datadir=pathThe path to the MariaDB data directory.
--forceCauses mysql_install_db to run even if DNS does not work. In that case, grant table entries that normally use hostnames will use IP addresses.
--ldata=pathThe path to the MariaDB data directory. Same as --datadir.
--rpmFor internal use. This option is used by RPM files during the MariaDB installation process.
--skip-name-resolveUse IP addresses rather than hostnames when creating grant table entries. This option can be useful if your DNS does not work.
--srcdir=pathThe path to the MariaDB source directory. This option uses the compiled binaries and support files within the source tree, useful for if you don't want to install MariaDB yet and just want to create the system tables.
--user=user_nameThe login username to use for running mysqld. Files and directories created by mysqld will be owned by this user. You must be root to use this option. By default mysqld runs using your current login name and files and directories that it creates will be owned by you.

mysql_install_db reads the my.cnf groups [mysqld] and [mysql_install_db].

mysql_install_db works by starting the mysqld server in --bootstrap mode and sending commands to create the system tables and their content.

If mysql_install_db fails, you should examine the logs (*.err files) in the data directory (the one specified with --datadir) for a clue of what went wrong.

You can also test that this is not a general fault of mysqld by starting mysqld with

mysqld --skip-grant --general-log

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.