Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MySQL 설치메뉴얼: Difference between revisions

From ZeroWiki
(Repair batch-0002 pages from live compare)
(Repair MoniWiki formatting after migration)
 
Line 27: Line 27:
## Obtain a distribution file using the instructions in *Note
## Obtain a distribution file using the instructions in *Note
     getting-mysql::. For a given release, binary distributions for all
     getting-mysql::. For a given release, binary distributions for all
     platforms are built from the same MySQL source distribution.
     platforms are built from the same [[MySQL]] source distribution.


## Unpack the distribution, which creates the installation directory.
## Unpack the distribution, which creates the installation directory.
Line 56: Line 56:
***** The `bin' directory contains client programs and the server.
***** The `bin' directory contains client programs and the server.
           You should add the full pathname of this directory to your
           You should add the full pathname of this directory to your
           `PATH' environment variable so that your shell finds the MySQL
           `PATH' environment variable so that your shell finds the [[MySQL]]
           programs properly. See *Note environment-variables::.
           programs properly. See *Note environment-variables::.


Line 63: Line 63:
           grant tables that store the server access permissions.
           grant tables that store the server access permissions.


## If you have not installed MySQL before, you must create the MySQL
## If you have not installed [[MySQL]] before, you must create the [[MySQL]]
     grant tables:
     grant tables:


Line 91: Line 91:
     attribute to the `mysql' group.
     attribute to the `mysql' group.


## If you want MySQL to start automatically when you boot your
## If you want [[MySQL]] to start automatically when you boot your
     machine, you can copy `support-files/mysql.server' to the location
     machine, you can copy `support-files/mysql.server' to the location
     where your system has its startup files. More information can be
     where your system has its startup files. More information can be
Line 101: Line 101:
     instructions, see *Note perl-support::.
     instructions, see *Note perl-support::.


# If you would like to use `mysqlaccess' and have the MySQL
# If you would like to use `mysqlaccess' and have the [[MySQL]]
     distribution in some non-standard location, you must change the
     distribution in some non-standard location, you must change the
     location where `mysqlaccess' expects to find the `mysql' client.
     location where `mysqlaccess' expects to find the `mysql' client.
Line 114: Line 114:


After everything has been unpacked and installed, you should test your
After everything has been unpacked and installed, you should test your
distribution. To start the MySQL server, use the following command:
distribution. To start the [[MySQL]] server, use the following command:


     shell> bin/mysqld_safe --user=mysql &
     shell> bin/mysqld_safe --user=mysql &
Line 123: Line 123:
More information about `mysqld_safe' is given in *Note mysqld-safe::.
More information about `mysqld_safe' is given in *Note mysqld-safe::.


*Note*: The accounts that are listed in the MySQL grant tables
*Note*: The accounts that are listed in the [[MySQL]] grant tables
initially have no passwords.  After starting the server, you should set
initially have no passwords.  After starting the server, you should set
up passwords for them using the instructions in *Note
up passwords for them using the instructions in *Note
post-installation::.
post-installation::.

Latest revision as of 00:34, 29 March 2026

A more detailed version of the preceding description for installing a binary distribution follows:

    1. Add a login user and group for `mysqld' to run as:
         shell> groupadd mysql
         shell> useradd -g mysql mysql
    These commands add the `mysql' group and the `mysql' user. The
    syntax for `useradd' and `groupadd' may differ slightly on
    different versions of Unix, or they may have different names such
    as `adduser' and `addgroup'.
    You might want to call the user and group something else instead
    of `mysql'. If so, substitute the appropriate name in the
    following steps.
    1. Pick the directory under which you want to unpack the distribution
    and change location into it. In the following example, we unpack
    the distribution under `/usr/local'. (The instructions, therefore,
    assume that you have permission to create files and directories in
    `/usr/local'. If that directory is protected, you must perform the
    installation as `root'.)
         shell> cd /usr/local
    1. Obtain a distribution file using the instructions in *Note
    getting-mysql::. For a given release, binary distributions for all
    platforms are built from the same MySQL source distribution.
    1. Unpack the distribution, which creates the installation directory.
    Then create a symbolic link to that directory:
         shell> gunzip < /PATH/TO/MYSQL-VERSION-OS.tar.gz | tar xvf -
         shell> ln -s FULL-PATH-TO-MYSQL-VERSION-OS mysql
    The `tar' command creates a directory named `mysql-VERSION-OS'.
    The `ln' command makes a symbolic link to that directory. This
    lets you refer more easily to the installation directory as
    `/usr/local/mysql'.
    With GNU `tar', no separate invocation of `gunzip' is necessary.
    You can replace the first line with the following alternative
    command to uncompress and extract the distribution:
         shell> tar zxvf /PATH/TO/MYSQL-VERSION-OS.tar.gz
    1. Change location into the installation directory:
         shell> cd mysql
    You will find several files and subdirectories in the `mysql'
    directory. The most important for installation purposes are the
    `bin' and `scripts' subdirectories:
          • The `bin' directory contains client programs and the server.
         You should add the full pathname of this directory to your
         `PATH' environment variable so that your shell finds the MySQL
         programs properly. See *Note environment-variables::.
          • The `scripts' directory contains the `mysql_install_db'
         script used to initialize the `mysql' database containing the
         grant tables that store the server access permissions.
    1. If you have not installed MySQL before, you must create the MySQL
    grant tables:
         shell> scripts/mysql_install_db --user=mysql
    If you run the command as `root', you must use the -user option as
    shown. The value of the option should be the name of the login
    account that you created in the first step to use for running the
    server. If you run the command while logged in as that user, you
    can omit the -user option.
    After creating or updating the grant tables, you need to restart
    the server manually.
    1. Change the ownership of program binaries to `root' and ownership
    of the data directory to the user that you run `mysqld' as.
    Assuming that you are located in the installation directory
    (`/usr/local/mysql'), the commands look like this:
         shell> chown -R root  .
         shell> chown -R mysql data
         shell> chgrp -R mysql .
    The first command changes the owner attribute of the files to the
    `root' user. The second changes the owner attribute of the data
    directory to the `mysql' user. The third changes the group
    attribute to the `mysql' group.
    1. If you want MySQL to start automatically when you boot your
    machine, you can copy `support-files/mysql.server' to the location
    where your system has its startup files. More information can be
    found in the `support-files/mysql.server' script itself and in
    *Note automatic-start::.
    1. You can set up new accounts using the `bin/mysql_setpermission'
    script if you install the `DBI' and `DBD::mysql' Perl modules. For
    instructions, see *Note perl-support::.
  1. If you would like to use `mysqlaccess' and have the MySQL
    distribution in some non-standard location, you must change the
    location where `mysqlaccess' expects to find the `mysql' client.
    Edit the `bin/mysqlaccess' script at approximately line 18. Search
    for a line that looks like this:
         $MYSQL     = '/usr/local/bin/mysql';    # path to mysql executable
    Change the path to reflect the location where `mysql' actually is
    stored on your system. If you do not do this, a `Broken pipe' error
    will occur when you run `mysqlaccess'.

After everything has been unpacked and installed, you should test your distribution. To start the MySQL server, use the following command:

    shell> bin/mysqld_safe --user=mysql &

If that command fails immediately and prints `mysqld ended', you can find some information in the `HOST_NAME.err' file in the data directory.

More information about `mysqld_safe' is given in *Note mysqld-safe::.

  • Note*: The accounts that are listed in the MySQL grant tables

initially have no passwords. After starting the server, you should set up passwords for them using the instructions in *Note post-installation::.