Answer Diff [24]
##mysql_install_db## is needed to create the system tables in the 'mysql'
¶
database directory. MariaDB uses these tables to manage user rights and provide ¶
the ##'[[help-command|help]]'## command. ¶
¶
The normal usage of it is: ¶
<<code>> ¶
mysql_install_db --user=mysql ¶
<</code>> ¶
¶
Here is a list of the options ##mysql_install_db## supports: ¶
<<style class="borders">> ¶
| ##{{{--}}}basedir=path## | The path to the MariaDB installation directory.| ¶
| ##{{{--}}}builddir=path## | If 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-bootstrap## | For internal use. Used when building the MariaDB system tables on a different host than the target.| ¶
| ##{{{--}}}datadir=path## | The path to the MariaDB data directory.| ¶
| ##{{{--}}}force## | Causes ##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=path## | The path to the MariaDB data directory. Same as '##{{{--}}}datadir##'.| ¶
| ##{{{--}}}no-defaults## | Don't read any configuration files (my.cnf).| ¶
| ##{{{--}}}defaults-file=path## | Read only this configuration file.| ¶
| ##{{{--}}}rpm## | For internal use. This option is used by RPM files during the MariaDB installation process.| ¶
| ##{{{--}}}skip-name-resolve## | Use IP addresses rather than hostnames when creating grant table entries. This option can be useful if your DNS does not work.| ¶
| ##{{{--}}}srcdir=path## | The 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_name## | The 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.| ¶
<</style>> ¶
¶
##mysql_install_db## reads the my.cnf groups ##[mysqld]## and ¶
##[mysql_install_db]##. In MariaDB 5.2 (and later), ##mysql_install_db## also ¶
reads the my.cnf groups ##[mariadb]## and ##[client-server]##. ¶
¶
##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 ¶
¶
<<code>> ¶
mysqld --skip-grant --general-log ¶
<</code>> ¶
¶
and use the ##[[mysql-command-line-client|mysql]]## command line client tool ¶
(often located at ##/usr/local/mysql/bin/mysql## for tarball installations of ¶
MariaDB) to connect to the mysql database and look at the grant tables: ¶
<<code>> ¶
shell> /usr/local/mysql/bin/mysql -u root mysql ¶
MariaDB [mysql]> show tables ¶
<</code>> ¶
¶
== Installing a binary tar distribution: ¶
¶
If you install a tar file in a non standard path, like your home directory, and ¶
you already have a MariaDB / MySQL package installed, you may get conflicts ¶
with the default my.cnf file under ##/etc/##. This often results in permissions ¶
errors. ¶
¶
The solution for this is to either execute the following command from the ¶
installation directory: ¶
¶
<<code>> ¶
./scripts/mysql_install_db --no-defaults --basedir=. --datadir=data ¶
<</code>> ¶
¶
or to specify your own config file (with the appropriate locations specified within it): ¶
¶
<<code>> ¶
./scripts/mysql_install_db --defaults-file=~/.my.cnf ¶
<</code>> ¶
¶
== See also: ¶
¶
* [[mysql_install_db]] ¶
* The Windows version of ##mysql_install_db##: ##[[mysql_install_dbexe|mysql_install_db.exe]]## ¶
* You can find additional information about ##mysql_install_db## in the ¶
[[http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db.html|MySQL manual]]. ¶
¶
database directory. MariaDB uses these tables to manage user rights and provide ¶
the ##'[[help-command|help]]'## command. ¶
¶
The normal usage of it is: ¶
<<code>> ¶
mysql_install_db --user=mysql ¶
<</code>> ¶
¶
Here is a list of the options ##mysql_install_db## supports: ¶
<<style class="borders">> ¶
| ##{{{--}}}basedir=path## | The path to the MariaDB installation directory.| ¶
| ##{{{--}}}builddir=path## | If 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-bootstrap## | For internal use. Used when building the MariaDB system tables on a different host than the target.| ¶
| ##{{{--}}}datadir=path## | The path to the MariaDB data directory.| ¶
| ##{{{--}}}force## | Causes ##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=path## | The path to the MariaDB data directory. Same as '##{{{--}}}datadir##'.| ¶
| ##{{{--}}}no-defaults## | Don't read any configuration files (my.cnf).| ¶
| ##{{{--}}}defaults-file=path## | Read only this configuration file.| ¶
| ##{{{--}}}rpm## | For internal use. This option is used by RPM files during the MariaDB installation process.| ¶
| ##{{{--}}}skip-name-resolve## | Use IP addresses rather than hostnames when creating grant table entries. This option can be useful if your DNS does not work.| ¶
| ##{{{--}}}srcdir=path## | The 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_name## | The 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.| ¶
<</style>> ¶
¶
##mysql_install_db## reads the my.cnf groups ##[mysqld]## and ¶
##[mysql_install_db]##. In MariaDB 5.2 (and later), ##mysql_install_db## also ¶
reads the my.cnf groups ##[mariadb]## and ##[client-server]##. ¶
¶
##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 ¶
¶
<<code>> ¶
mysqld --skip-grant --general-log ¶
<</code>> ¶
¶
and use the ##[[mysql-command-line-client|mysql]]## command line client tool ¶
(often located at ##/usr/local/mysql/bin/mysql## for tarball installations of ¶
MariaDB) to connect to the mysql database and look at the grant tables: ¶
<<code>> ¶
shell> /usr/local/mysql/bin/mysql -u root mysql ¶
MariaDB [mysql]> show tables ¶
<</code>> ¶
¶
== Installing a binary tar distribution: ¶
¶
If you install a tar file in a non standard path, like your home directory, and ¶
you already have a MariaDB / MySQL package installed, you may get conflicts ¶
with the default my.cnf file under ##/etc/##. This often results in permissions ¶
errors. ¶
¶
The solution for this is to either execute the following command from the ¶
installation directory: ¶
¶
<<code>> ¶
./scripts/mysql_install_db --no-defaults --basedir=. --datadir=data ¶
<</code>> ¶
¶
or to specify your own config file (with the appropriate locations specified within it): ¶
¶
<<code>> ¶
./scripts/mysql_install_db --defaults-file=~/.my.cnf ¶
<</code>> ¶
¶
== See also: ¶
¶
* [[mysql_install_db]] ¶
* The Windows version of ##mysql_install_db##: ##[[mysql_install_dbexe|mysql_install_db.exe]]## ¶
* You can find additional information about ##mysql_install_db## in the ¶
[[http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db.html|MySQL manual]]. ¶
¶