mysql copry install-binary 翻译
时间:2007-01-30 来源:luozhongbiao
注:所有的翻译都在生词后一个括号内,
2.8 Installing MySQL on Other Unix-Like Systems
===============================================
This section(会话) covers the installation of MySQL binary distributions(文件) that
are provided for various(不同的) platforms(平台) in the form of (以。。的形式)compressed (被压缩)`tar'files (files with a `.tar.gz' extension). See *Note mysql-binaries::,
for a detailed list.
To obtain MySQL, see *Note getting-mysql::.
MySQL `tar' file binary(二进制) distributions have names of the form
`mysql-VERSION-OS.tar.gz', where `VERSION' is a number (for example,
`5.0.25'), and OS indicates the type of operating system for which the
distribution is intended (for example, `pc-linux-i686').
In addition to these generic packages, we also offer binaries in
platform-specific package formats for selected platforms. See *Note
quick-standard-installation::, for more information on how to install
these.
You need the following tools to install a MySQL `tar' file binary
distribution:
* GNU `gunzip' to uncompress the distribution.
* A reasonable `tar' to unpack the distribution. GNU `tar' is known
to work. Some operating systems come with a pre-installed version
of `tar' that is known to have problems. For example, Mac OS X
`tar' and Sun `tar' are known to have problems with long
filenames. On Mac OS X, you can use the pre-installed (预安装)`gnutar'
program. On other systems with a deficient `tar', you should
install GNU `tar' first.
If you run into problems and need to file a bug report, please use the
instructions in *Note bug-reports::.
The basic commands that you must execute to install and use a MySQL
binary distribution are:
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /PATH/TO/MYSQL-VERSION-OS.tar.gz | tar xvf -
shell> ln -s FULL-PATH-TO-MYSQL-VERSION-OS mysql
shell> cd mysql
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
*Note*: This procedure(程序) does not set up any passwords for MySQL
accounts(帐户). After following the procedure, proceed to *Note
post-installation::.
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.
2. [2—4]解压
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
3. 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.
4. 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
5. 注意事项
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许可数据.
6.新建许可列表
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.手动
7. 更改目录和文件所有权
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.
8.设置自启动
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::.
9. 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::.
10.应该是设置环境变量
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::.