~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to Docs/INSTALL-BINARY

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-21 15:31:05 UTC
  • mfrom: (1.1.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20100621153105-pbbz3t6nyrf9t2zq
Tags: upstream-5.1.48
ImportĀ upstreamĀ versionĀ 5.1.48

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
2.2. Installing MySQL from Generic Binaries on Unix/Linux
 
3
 
 
4
   This section covers the installation of MySQL binary distributions
 
5
   that are provided for various platforms in the form of compressed
 
6
   tar files (files with a .tar.gz extension).
 
7
 
 
8
   To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
 
9
 
 
10
   Sun Microsystems, Inc. provides a set of binary distributions of
 
11
   MySQL. In addition to binaries provided in platform-specific
 
12
   package formats, we offer binary distributions for a number of
 
13
   platforms in the form of compressed tar files (.tar.gz files). For
 
14
   Windows distributions, see Section 2.5, "Installing MySQL on
 
15
   Windows."
 
16
 
 
17
   If you want to compile a debug version of MySQL from a source
 
18
   distribution, you should add --with-debug or --with-debug=full to
 
19
   the configure command used to configure the distribution and
 
20
   remove any -fomit-frame-pointer options.
 
21
 
 
22
   MySQL tar file binary distributions have names of the form
 
23
   mysql-VERSION-OS.tar.gz, where VERSION is a number (for example,
 
24
   5.1.49), and OS indicates the type of operating system for which
 
25
   the distribution is intended (for example, pc-linux-i686).
 
26
 
 
27
   In addition to these generic packages, we also offer binaries in
 
28
   platform-specific package formats for selected platforms. See the
 
29
   platform specific sections for more information, for more
 
30
   information on how to install these.
 
31
 
 
32
   You need the following tools to install a MySQL tar file binary
 
33
   distribution:
 
34
 
 
35
     * GNU gunzip to uncompress the distribution.
 
36
 
 
37
     * A reasonable tar to unpack the distribution. GNU tar is known
 
38
       to work. Some operating systems come with a preinstalled
 
39
       version of tar that is known to have problems. For example,
 
40
       the tar provided with early versions of Mac OS X, SunOS 4.x,
 
41
       Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
 
42
       are known to have problems with long file names. On Mac OS X,
 
43
       you can use the preinstalled gnutar program. On Solaris 10 and
 
44
       OpenSolaris you can use the preinstalled gtar. On other
 
45
       systems with a deficient tar, you should install GNU tar
 
46
       first.
 
47
 
 
48
   If you run into problems and need to file a bug report, please use
 
49
   the instructions in Section 1.7, "How to Report Bugs or Problems."
 
50
 
 
51
   The basic commands that you must execute to install and use a
 
52
   MySQL binary distribution are:
 
53
shell> groupadd mysql
 
54
shell> useradd -g mysql mysql
 
55
shell> cd /usr/local
 
56
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
 
57
shell> ln -s full-path-to-mysql-VERSION-OS mysql
 
58
shell> cd mysql
 
59
shell> chown -R mysql .
 
60
shell> chgrp -R mysql .
 
61
shell> scripts/mysql_install_db --user=mysql
 
62
shell> chown -R root .
 
63
shell> chown -R mysql data
 
64
shell> bin/mysqld_safe --user=mysql &
 
65
 
 
66
Note
 
67
 
 
68
   This procedure does not set up any passwords for MySQL accounts.
 
69
   After following the procedure, proceed to Section 2.13,
 
70
   "Post-Installation Setup and Testing."
 
71
 
 
72
   A more detailed version of the preceding description for
 
73
   installing a binary distribution follows:
 
74
 
 
75
    1. Add a login user and group for mysqld to run as:
 
76
shell> groupadd mysql
 
77
shell> useradd -g mysql mysql
 
78
       These commands add the mysql group and the mysql user. The
 
79
       syntax for useradd and groupadd may differ slightly on
 
80
       different versions of Unix, or they may have different names
 
81
       such as adduser and addgroup.
 
82
       You might want to call the user and group something else
 
83
       instead of mysql. If so, substitute the appropriate name in
 
84
       the following steps.
 
85
 
 
86
    2. Pick the directory under which you want to unpack the
 
87
       distribution and change location into it. In the following
 
88
       example, we unpack the distribution under /usr/local. (The
 
89
       instructions, therefore, assume that you have permission to
 
90
       create files and directories in /usr/local. If that directory
 
91
       is protected, you must perform the installation as root.)
 
92
shell> cd /usr/local
 
93
 
 
94
    3. Obtain a distribution file using the instructions in Section
 
95
       2.1.3, "How to Get MySQL." For a given release, binary
 
96
       distributions for all platforms are built from the same MySQL
 
97
       source distribution.
 
98
 
 
99
    4. Unpack the distribution, which creates the installation
 
100
       directory. Then create a symbolic link to that directory:
 
101
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
 
102
shell> ln -s full-path-to-mysql-VERSION-OS mysql
 
103
       The tar command creates a directory named mysql-VERSION-OS.
 
104
       The ln command makes a symbolic link to that directory. This
 
105
       lets you refer more easily to the installation directory as
 
106
       /usr/local/mysql.
 
107
       With GNU tar, no separate invocation of gunzip is necessary.
 
108
       You can replace the first line with the following alternative
 
109
       command to uncompress and extract the distribution:
 
110
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
 
111
 
 
112
    5. Change location into the installation directory:
 
113
shell> cd mysql
 
114
       You will find several files and subdirectories in the mysql
 
115
       directory. The most important for installation purposes are
 
116
       the bin and scripts subdirectories:
 
117
 
 
118
          + The bin directory contains client programs and the
 
119
            server. You should add the full path name of this
 
120
            directory to your PATH environment variable so that your
 
121
            shell finds the MySQL programs properly. See Section
 
122
            2.14, "Environment Variables."
 
123
 
 
124
          + The scripts directory contains the mysql_install_db
 
125
            script used to initialize the mysql database containing
 
126
            the grant tables that store the server access
 
127
            permissions.
 
128
 
 
129
    6. Ensure that the distribution contents are accessible to mysql.
 
130
       If you unpacked the distribution as mysql, no further action
 
131
       is required. If you unpacked the distribution as root, its
 
132
       contents will be owned by root. Change its ownership to mysql
 
133
       by executing the following commands as root in the
 
134
       installation directory:
 
135
shell> chown -R mysql .
 
136
shell> chgrp -R mysql .
 
137
       The first command changes the owner attribute of the files to
 
138
       the mysql user. The second changes the group attribute to the
 
139
       mysql group.
 
140
 
 
141
    7. If you have not installed MySQL before, you must create the
 
142
       MySQL data directory and initialize the grant tables:
 
143
shell> scripts/mysql_install_db --user=mysql
 
144
       If you run the command as root, include the --user option as
 
145
       shown. If you run the while logged in as that user, you can
 
146
       omit the --user option.
 
147
       The command should create the data directory and its contents
 
148
       with mysql as the owner.
 
149
       After creating or updating the grant tables, you need to
 
150
       restart the server manually.
 
151
 
 
152
    8. Most of the MySQL installation can be owned by root if you
 
153
       like. The exception is that the data directory must be owned
 
154
       by mysql. To accomplish this, run the following commands as
 
155
       root in the installation directory:
 
156
shell> chown -R root .
 
157
shell> chown -R mysql data
 
158
 
 
159
    9. If the plugin directory is writable by the server, it may be
 
160
       possible for a user to write executable code to a file in the
 
161
       directory using SELECT ... INTO DUMPFILE. This can be
 
162
       prevented by making plugin_dir read only to the server or by
 
163
       setting --secure-file-priv to a directory where SELECT writes
 
164
       can be made safely.
 
165
   10. If you want MySQL to start automatically when you boot your
 
166
       machine, you can copy support-files/mysql.server to the
 
167
       location where your system has its startup files. More
 
168
       information can be found in the support-files/mysql.server
 
169
       script itself and in Section 2.13.1.2, "Starting and Stopping
 
170
       MySQL Automatically."
 
171
   11. You can set up new accounts using the bin/mysql_setpermission
 
172
       script if you install the DBI and DBD::mysql Perl modules. See
 
173
       Section 4.6.14, "mysql_setpermission --- Interactively Set
 
174
       Permissions in Grant Tables." For Perl module installation
 
175
       instructions, see Section 2.15, "Perl Installation Notes."
 
176
   12. If you would like to use mysqlaccess and have the MySQL
 
177
       distribution in some nonstandard location, you must change the
 
178
       location where mysqlaccess expects to find the mysql client.
 
179
       Edit the bin/mysqlaccess script at approximately line 18.
 
180
       Search for a line that looks like this:
 
181
$MYSQL     = '/usr/local/bin/mysql';    # path to mysql executable
 
182
       Change the path to reflect the location where mysql actually
 
183
       is stored on your system. If you do not do this, a Broken pipe
 
184
       error will occur when you run mysqlaccess.
 
185
 
 
186
   After everything has been unpacked and installed, you should test
 
187
   your distribution. To start the MySQL server, use the following
 
188
   command:
 
189
shell> bin/mysqld_safe --user=mysql &
 
190
 
 
191
   If you run the command as root, you must use the --user option as
 
192
   shown. The value of the option is the name of the login account
 
193
   that you created in the first step to use for running the server.
 
194
   If you run the command while logged in as mysql, you can omit the
 
195
   --user option.
 
196
 
 
197
   If the command fails immediately and prints mysqld ended, you can
 
198
   find some information in the host_name.err file in the data
 
199
   directory.
 
200
 
 
201
   More information about mysqld_safe is given in Section 4.3.2,
 
202
   "mysqld_safe --- MySQL Server Startup Script."
 
203
 
 
204
Note
 
205
 
 
206
   The accounts that are listed in the MySQL grant tables initially
 
207
   have no passwords. After starting the server, you should set up
 
208
   passwords for them using the instructions in Section 2.13,
 
209
   "Post-Installation Setup and Testing."