GNU Info

Info Node: (mysql.info)Post-installation

(mysql.info)Post-installation


Next: Upgrade Prev: Installing source Up: Installing
Enter node , (file) or (file)node

Post-installation Setup and Testing
===================================

mysql_install_db
Problems running `mysql_install_db'
Starting server
Problems starting the MySQL server
Automatic start
Starting and stopping MySQL automatically
Once you've installed MySQL (from either a binary or source
distribution), you need to initialize the grant tables, start the
server, and make sure that the server works okay.  You may also wish to
arrange for the server to be started and stopped automatically when
your system starts up and shuts down.

Normally you install the grant tables and start the server like this
for installation from a source distribution:

     shell> ./scripts/mysql_install_db
     shell> cd mysql_installation_directory
     shell> ./bin/safe_mysqld --user=mysql &

For a binary distribution (not RPM or pkg packages), do this:

     shell> cd mysql_installation_directory
     shell> ./bin/mysql_install_db
     shell> ./bin/safe_mysqld --user=mysql &

This creates the `mysql' database which will hold all database
privileges, the `test' database which you can use to test MySQL and
also privilege entries for the user that run `mysql_install_db' and a
`root' user (without any passwords).  This also starts the `mysqld'
server.

`mysql_install_db' will not overwrite any old privilege tables, so it
should be safe to run in any circumstances.  If you don't want to have
the `test' database you can remove it with `mysqladmin -u root drop
test'.

Testing is most easily done from the top-level directory of the MySQL
distribution.  For a binary distribution, this is your installation
directory (typically something like `/usr/local/mysql').  For a source
distribution, this is the main directory of your MySQL source tree.

In the commands shown below in this section and in the following
subsections, `BINDIR' is the path to the location in which programs
like `mysqladmin' and `safe_mysqld' are installed.  For a binary
distribution, this is the `bin' directory within the distribution.  For
a source distribution, `BINDIR' is probably `/usr/local/bin', unless
you specified an installation directory other than `/usr/local' when
you ran `configure'.  `EXECDIR' is the location in which the `mysqld'
server is installed.  For a binary distribution, this is the same as
`BINDIR'.  For a source distribution, `EXECDIR' is probably
`/usr/local/libexec'.

Testing is described in detail below:

  1. If necessary, start the `mysqld' server and set up the initial
     MySQL grant tables containing the privileges that determine how
     users are allowed to connect to the server.  This is normally done
     with the `mysql_install_db' script:

          shell> scripts/mysql_install_db

     Typically, `mysql_install_db' needs to be run only the first time
     you install MySQL.  Therefore, if you are upgrading an existing
     installation, you can skip this step.  (However,
     `mysql_install_db' is quite safe to use and will not update any
     tables that already exist, so if you are unsure of what to do, you
     can always run `mysql_install_db'.)

     `mysql_install_db' creates six tables (`user', `db', `host',
     `tables_priv', `columns_priv', and `func') in the `mysql'
     database.  A description of the initial privileges is given in
     Note: Default privileges.  Briefly, these privileges allow the
     MySQL `root' user to do anything, and allow anybody to create or
     use databases with a name of `'test'' or starting with `'test_''.

     If you don't set up the grant tables, the following error will
     appear in the log file when you start the server:

          mysqld: Can't find file: 'host.frm'

     The above may also happen with a binary MySQL distribution if you
     don't start MySQL by executing exactly `./bin/safe_mysqld'!  Note:
     `safe_mysqld'.

     You might need to run `mysql_install_db' as `root'.  However, if
     you prefer, you can run the MySQL server as an unprivileged
     (non-`root') user, provided that user can read and write files in
     the database directory.  Instructions for running MySQL as an
     unprivileged user are given in Note: Changing MySQL user.


     If you have problems with `mysql_install_db', see Note:
     `mysql_install_db'.

     There are some alternatives to running the `mysql_install_db'
     script as it is provided in the MySQL distribution:

        * You may want to edit `mysql_install_db' before running it, to
          change the initial privileges that are installed into the
          grant tables.  This is useful if you want to install MySQL on
          a lot of machines with the same privileges.  In this case you
          probably should need only to add a few extra `INSERT'
          statements to the `mysql.user' and `mysql.db' tables!

        * If you want to change things in the grant tables after
          installing them, you can run `mysql_install_db', then use
          `mysql -u root mysql' to connect to the grant tables as the
          MySQL `root' user and issue SQL statements to modify the
          grant tables directly.

        * It is possible to re-create the grant tables completely after
          they have already been created.  You might want to do this if
          you've already installed the tables but then want to
          re-create them after editing `mysql_install_db'.

     For more information about these alternatives, see Note: Default
     privileges.

  2. Start the MySQL server like this:

          shell> cd mysql_installation_directory
          shell> bin/safe_mysqld &

     If you have problems starting the server, see Note: Starting
     server.

  3. Use `mysqladmin' to verify that the server is running.  The
     following commands provide a simple test to check that the server
     is up and responding to connections:

          shell> BINDIR/mysqladmin version
          shell> BINDIR/mysqladmin variables

     The output from `mysqladmin version' varies slightly depending on
     your platform and version of MySQL, but should be similar to that
     shown below:

          shell> BINDIR/mysqladmin version
          mysqladmin  Ver 8.14 Distrib 3.23.32, for linux on i586
          Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
          This software comes with ABSOLUTELY NO WARRANTY. This is free software,
          and you are welcome to modify and redistribute it under the GPL license
          
          Server version          3.23.32-debug
          Protocol version        10
          Connection              Localhost via Unix socket
          TCP port                3306
          UNIX socket             /tmp/mysql.sock
          Uptime:                 16 sec
          
          Threads: 1  Questions: 9  Slow queries: 0  Opens: 7  Flush tables: 2  Open tables: 0 Queries per second avg: 0.000  Memory in use: 132K  Max memory used: 16773K

     To get a feeling for what else you can do with `BINDIR/mysqladmin',
     invoke it with the `--help' option.

  4. Verify that you can shut down the server:

          shell> BINDIR/mysqladmin -u root shutdown

  5. Verify that you can restart the server.  Do this using
     `safe_mysqld' or by invoking `mysqld' directly.  For example:

          shell> BINDIR/safe_mysqld --log &

     If `safe_mysqld' fails, try running it from the MySQL installation
     directory (if you are not already there).  If that doesn't work,
     see Note: Starting server.

  6. Run some simple tests to verify that the server is working.  The
     output should be similar to what is shown below:

          shell> BINDIR/mysqlshow
          +-----------+
          | Databases |
          +-----------+
          | mysql     |
          +-----------+
          
          shell> BINDIR/mysqlshow mysql
          Database: mysql
          +--------------+
          |    Tables    |
          +--------------+
          | columns_priv |
          | db           |
          | func         |
          | host         |
          | tables_priv  |
          | user         |
          +--------------+
          
          shell> BINDIR/mysql -e "select host,db,user from db" mysql
          +------+--------+------+
          | host | db     | user |
          +------+--------+------+
          | %    | test   |      |
          | %    | test_% |      |
          +------+--------+------+

     There is also a benchmark suite in the `sql-bench' directory
     (under the MySQL installation directory) that you can use to
     compare how MySQL performs on different platforms.  The
     `sql-bench/Results' directory contains the results from many runs
     against different databases and platforms.  To run all tests,
     execute these commands:

          shell> cd sql-bench
          shell> run-all-tests

     If you don't have the `sql-bench' directory, you are probably
     using an RPM for a binary distribution.  (Source distribution RPMs
     include the benchmark directory.)  In this case, you must first
     install the benchmark suite before you can use it.  Beginning with
     MySQL Version 3.22, there are benchmark RPM files named
     `mysql-bench-VERSION-i386.rpm' that contain benchmark code and
     data.

     If you have a source distribution, you can also run the tests in
     the `tests' subdirectory. For example, to run
     `auto_increment.tst', do this:

          shell> BINDIR/mysql -vvf test < ./tests/auto_increment.tst

     The expected results are shown in the `./tests/auto_increment.res'
     file.


automatically generated by info2www version 1.2.2.9