1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!ENTITY mysql-download-http "http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-&mysql-version;.tar.gz">
|
---|
8 | <!ENTITY mysql-download-ftp " ">
|
---|
9 | <!ENTITY mysql-md5sum "82baf46acfced6eef072e9d8a479c86e">
|
---|
10 | <!ENTITY mysql-size "24 MB">
|
---|
11 | <!ENTITY mysql-buildsize "930 MB (additional 170 MB to run the test suite)">
|
---|
12 | <!ENTITY mysql-time "4.4 SBU (Test suite is an additional 45 minutes, only partially CPU dependent)">
|
---|
13 | ]>
|
---|
14 |
|
---|
15 | <sect1 id="mysql" xreflabel="MySQL-&mysql-version;">
|
---|
16 | <?dbhtml filename="mysql.html"?>
|
---|
17 |
|
---|
18 | <sect1info>
|
---|
19 | <othername>$LastChangedBy$</othername>
|
---|
20 | <date>$Date$</date>
|
---|
21 | </sect1info>
|
---|
22 |
|
---|
23 | <title>MySQL-&mysql-version;</title>
|
---|
24 |
|
---|
25 | <indexterm zone="mysql">
|
---|
26 | <primary sortas="a-MySQL">MySQL</primary>
|
---|
27 | </indexterm>
|
---|
28 |
|
---|
29 | <sect2 role="package">
|
---|
30 | <title>Introduction to MySQL</title>
|
---|
31 |
|
---|
32 | <para><application>MySQL</application> is a widely used and fast SQL
|
---|
33 | database server. It is a client/server implementation that consists of a
|
---|
34 | server daemon and many different client programs and libraries.</para>
|
---|
35 |
|
---|
36 | &lfs71_checked;
|
---|
37 |
|
---|
38 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
39 | <itemizedlist spacing="compact">
|
---|
40 | <listitem>
|
---|
41 | <para>Download (HTTP): <ulink url="&mysql-download-http;"/></para>
|
---|
42 | </listitem>
|
---|
43 | <listitem>
|
---|
44 | <para>Download (FTP): <ulink url="&mysql-download-ftp;"/></para>
|
---|
45 | </listitem>
|
---|
46 | <listitem>
|
---|
47 | <para>Download MD5 sum: &mysql-md5sum;</para>
|
---|
48 | </listitem>
|
---|
49 | <listitem>
|
---|
50 | <para>Download size: &mysql-size;</para>
|
---|
51 | </listitem>
|
---|
52 | <listitem>
|
---|
53 | <para>Estimated disk space required: &mysql-buildsize;</para>
|
---|
54 | </listitem>
|
---|
55 | <listitem>
|
---|
56 | <para>Estimated build time: &mysql-time;</para>
|
---|
57 | </listitem>
|
---|
58 | </itemizedlist>
|
---|
59 |
|
---|
60 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
61 | <itemizedlist spacing="compact">
|
---|
62 | <listitem>
|
---|
63 | <para>Optional patch (required if building for Amarok): <ulink
|
---|
64 | url="&patch-root;/mysql-&mysql-version;-embedded_library_shared-1.patch"/></para>
|
---|
65 | </listitem>
|
---|
66 | <listitem>
|
---|
67 | <para>Optional patch (required if building only the client): <ulink
|
---|
68 | url="&patch-root;/mysql-&mysql-version;-fix_client_only-1.patch"/></para>
|
---|
69 | </listitem>
|
---|
70 | <listitem>
|
---|
71 | <para>Optional Documentation (see tip below):
|
---|
72 | <ulink url="http://dev.mysql.com/doc/"/>
|
---|
73 | </para>
|
---|
74 | </listitem>
|
---|
75 | </itemizedlist>
|
---|
76 |
|
---|
77 | <bridgehead renderas="sect3">MySQL Dependencies</bridgehead>
|
---|
78 |
|
---|
79 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
80 | <para role="optional"><xref linkend="cmake"/></para>
|
---|
81 |
|
---|
82 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
83 | <para role="optional"><xref linkend="openssl"/></para>
|
---|
84 |
|
---|
85 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
86 | <para role="optional">
|
---|
87 | <ulink url="http://packages.debian.org/source/sid/libaio">libaio</ulink>
|
---|
88 | </para>
|
---|
89 |
|
---|
90 | <para condition="html" role="usernotes">User Notes:
|
---|
91 | <ulink url="&blfs-wiki;/mysql"/></para>
|
---|
92 |
|
---|
93 | </sect2>
|
---|
94 |
|
---|
95 | <sect2 role="installation">
|
---|
96 | <title>Installation of MySQL</title>
|
---|
97 |
|
---|
98 | <sect3>
|
---|
99 | <title>Building</title>
|
---|
100 |
|
---|
101 | <para>For security reasons, running the server as an unprivileged user
|
---|
102 | and group is strongly encouraged. Issue the following (as
|
---|
103 | <systemitem class="username">root</systemitem>) to create the user and
|
---|
104 | group:</para>
|
---|
105 |
|
---|
106 | <screen role="root"><userinput>groupadd -g 40 mysql &&
|
---|
107 | useradd -c "MySQL Server" -d /dev/null -g mysql -s /bin/false -u 40 mysql</userinput></screen>
|
---|
108 |
|
---|
109 | <para>If the MySQL server is not needed, it is possible to build only the
|
---|
110 | client libraries of MySQL. To do this you need to apply the optional patch,
|
---|
111 | use the cmake option <parameter>-DWITHOUT_SERVER=ON</parameter> and the
|
---|
112 | client-only installation instructions below.</para>
|
---|
113 |
|
---|
114 | <para>MySQL contains an embedded server library which can be enabled with
|
---|
115 | the cmake option <parameter>-DWITH_EMBEDDED_SERVER=ON</parameter>. By default
|
---|
116 | this server is built as a statically linked library,
|
---|
117 | <filename>libmysqld.a</filename>, but by applying the optional patch, a
|
---|
118 | shared version of this library can be built. The shared library is needed
|
---|
119 | by certain applications, such as <application>Amarok</application>.</para>
|
---|
120 |
|
---|
121 | <para>There are numerous options available to
|
---|
122 | <userinput>cmake</userinput>. Check the output of the `<userinput>cmake .
|
---|
123 | -LH</userinput>` for additional customization options. See the <ulink
|
---|
124 | url="http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html">MySQL
|
---|
125 | Documentation</ulink> for a full listing of all options.</para>
|
---|
126 |
|
---|
127 | <para>If you want the shared version of the embedded server library, apply
|
---|
128 | the patch:</para>
|
---|
129 |
|
---|
130 | <screen><userinput>patch -Np1 -i ../mysql-&mysql-version;-embedded_library_shared-1.patch</userinput></screen>
|
---|
131 |
|
---|
132 | <para>If building the client-only, apply the patch:</para>
|
---|
133 |
|
---|
134 | <screen><userinput>patch -Np1 -i ../mysql-&mysql-version;-fix_client_only-1.patch</userinput></screen>
|
---|
135 |
|
---|
136 | <para>Configure and build <application>MySQL</application> by
|
---|
137 | running the following commands:</para>
|
---|
138 |
|
---|
139 | <screen><userinput>mkdir build &&
|
---|
140 | cd build &&
|
---|
141 | cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
---|
142 | -DINSTALL_DOCDIR=share/doc/mysql \
|
---|
143 | -DINSTALL_DOCREADMEDIR=share/doc/mysql \
|
---|
144 | -DINSTALL_INCLUDEDIR=include/mysql \
|
---|
145 | -DINSTALL_INFODIR=share/info \
|
---|
146 | -DINSTALL_MANDIR=share/man \
|
---|
147 | -DINSTALL_MYSQLDATADIR=/srv/mysql \
|
---|
148 | -DINSTALL_MYSQLSHAREDIR=share/mysql \
|
---|
149 | -DINSTALL_MYSQLTESTDIR=share/mysql/test \
|
---|
150 | -DINSTALL_PLUGINDIR=lib/mysql \
|
---|
151 | -DINSTALL_SBINDIR=sbin \
|
---|
152 | -DINSTALL_SCRIPTDIR=bin \
|
---|
153 | -DINSTALL_SQLBENCHDIR=share/mysql/bench \
|
---|
154 | -DINSTALL_SUPPORTFILESDIR=share/mysql/support \
|
---|
155 | -DMYSQL_DATADIR=/srv/mysql \
|
---|
156 | -DMYSQL_UNIX_ADDR=/var/run/mysql/mysql.sock \
|
---|
157 | -DSYSCONFDIR=/etc \
|
---|
158 | -DWITH_PARTITION_STORAGE_ENGINE=OFF \
|
---|
159 | -DWITH_PERFSCHEMA_STORAGE_ENGINE=OFF \
|
---|
160 | -DWITH_READLINE=system \
|
---|
161 | -DWITH_SSL=system \
|
---|
162 | .. &&
|
---|
163 | make</userinput></screen>
|
---|
164 |
|
---|
165 | <para>To test the results, issue: <command>make test-force 2>&1 | tee
|
---|
166 | test.log</command>. This forces the test to run to completion and logs all
|
---|
167 | the test output. There will be many tests that are not run due to
|
---|
168 | configuration options and developer considerations. Note that if you use
|
---|
169 | TCP Wrappers and have a restrictive <filename>/etc/hosts.deny</filename>
|
---|
170 | file, you will need to add an appropriate entry to the
|
---|
171 | <filename>/etc/hosts.allow</filename> file for the
|
---|
172 | <command>mysqld</command> daemon. Otherwise many of the tests will
|
---|
173 | fail. Also, two tests will fail if ipv6 is not available in the kernel
|
---|
174 | either as a module or built in.</para>
|
---|
175 |
|
---|
176 | <note><para>The SSL tests may fail due to expired certificates.</para></note>
|
---|
177 | </sect3>
|
---|
178 |
|
---|
179 | <sect3>
|
---|
180 | <title>Installation (server and client)</title>
|
---|
181 |
|
---|
182 | <para>To install the server and client, issue the following command (as
|
---|
183 | the <systemitem class="username">root</systemitem> user):</para>
|
---|
184 |
|
---|
185 | <screen role="root"><userinput>SEGMENTS="Client Server IniFiles ManPages SharedLibraries"
|
---|
186 | SEGMENTS="$SEGMENTS Development Documentation Info Readme"
|
---|
187 |
|
---|
188 | for segment in $SEGMENTS; do
|
---|
189 | cmake -DCMAKE_INSTALL_COMPONENT=$segment -P cmake_install.cmake
|
---|
190 | done
|
---|
191 |
|
---|
192 | unset SEGMENTS</userinput></screen>
|
---|
193 |
|
---|
194 | <note><para>If you built the embedded server library add
|
---|
195 | <userinput>Embedded</userinput> to the <userinput>SEGMENTS</userinput>
|
---|
196 | variable above.</para></note>
|
---|
197 |
|
---|
198 | <tip><para>The only documentation shipped in the source tarball are
|
---|
199 | <filename>mysql.info</filename> and man pages. You can download various
|
---|
200 | formats of the <application>MySQL</application> Reference Manual
|
---|
201 | from <ulink url="http://dev.mysql.com/doc/"/>.</para></tip>
|
---|
202 |
|
---|
203 | </sect3>
|
---|
204 |
|
---|
205 | <sect3>
|
---|
206 | <title>Installation (client only)</title>
|
---|
207 | <para>If you would like to install the client software only, issue the
|
---|
208 | following (as <systemitem class="username">root</systemitem>):</para>
|
---|
209 |
|
---|
210 | <screen role="root"><userinput>SEGMENTS="Client ManPages SharedLibraries"
|
---|
211 | SEGMENTS="$SEGMENTS Development Documentation Info Readme"
|
---|
212 |
|
---|
213 | for segment in $SEGMENTS; do
|
---|
214 | cmake -DCMAKE_INSTALL_COMPONENT=$segment -P cmake_install.cmake
|
---|
215 | done
|
---|
216 |
|
---|
217 | unset SEGMENTS</userinput></screen>
|
---|
218 |
|
---|
219 | </sect3>
|
---|
220 |
|
---|
221 | </sect2>
|
---|
222 |
|
---|
223 | <sect2 role="commands">
|
---|
224 | <title>Command Explanations</title>
|
---|
225 |
|
---|
226 | <para><parameter>-DWITH_<engine>_STORAGE_ENGINE=ON</parameter>: The default
|
---|
227 | instructions only build the innobase (InnoDB) storage engine. If other
|
---|
228 | storage engines are desired use this switch to enable them. Valid choices
|
---|
229 | are ARCHIVE, BLACKHOLE, EXAMPLE, FEDERATED, INNOBASE, NDBCLUSTER,
|
---|
230 | PARTITION and PERFSCHEMA.</para>
|
---|
231 |
|
---|
232 | <para><parameter>-DWITHOUT_SERVER=ON</parameter>: Use this switch if you don't
|
---|
233 | want the server and would like to build the client only.</para>
|
---|
234 |
|
---|
235 | <para><parameter>-DWITH_EMBEDDED_SERVER=ON</parameter>: Use this switch to build
|
---|
236 | the embedded server library.</para>
|
---|
237 |
|
---|
238 | <para><parameter>-DWITH_SSL=system</parameter>: Use this switch to build
|
---|
239 | against a system version of SSL.</para>
|
---|
240 |
|
---|
241 | <para><command>cmake -DCMAKE_INSTALL_COMPONENT=$segment ...</command>: This
|
---|
242 | command installs the appropriate portion of the package. Different
|
---|
243 | segments may be added or deleted as desired. Valid segments are listed
|
---|
244 | with `<command>make list_install_components</command>`.
|
---|
245 | Note that the 'DataFiles' install segment does not honor the
|
---|
246 | -DMYSQL_DATADIR or -DINSTALL_MYSQLDATADIR statements and installs datafiles
|
---|
247 | in <filename class="directory">/usr/data</filename>.</para>
|
---|
248 |
|
---|
249 | </sect2>
|
---|
250 |
|
---|
251 | <sect2 role="configuration">
|
---|
252 | <title>Configuring MySQL</title>
|
---|
253 |
|
---|
254 | <sect3 id="mysql-config">
|
---|
255 | <title>Config Files</title>
|
---|
256 |
|
---|
257 | <para><filename>/etc/my.cnf</filename> and
|
---|
258 | <filename>~/.my.cnf</filename></para>
|
---|
259 |
|
---|
260 | <indexterm zone="mysql mysql-config">
|
---|
261 | <primary sortas="e-AA.my.cnf">~/.my.cnf</primary>
|
---|
262 | </indexterm>
|
---|
263 |
|
---|
264 | <indexterm zone="mysql mysql-config">
|
---|
265 | <primary sortas="e-etc-my.cnf">/etc/my.cnf</primary>
|
---|
266 | </indexterm>
|
---|
267 |
|
---|
268 | </sect3>
|
---|
269 |
|
---|
270 | <sect3>
|
---|
271 | <title>Configuration Information</title>
|
---|
272 |
|
---|
273 | <para>There are several default configuration files available in
|
---|
274 | <filename class="directory">/usr/share/mysql</filename> which you can
|
---|
275 | use. When creating the file, ensure binary logs are disabled unless you
|
---|
276 | are doing database replication. Create <filename>/etc/my.cnf</filename>
|
---|
277 | using the following commands as the <systemitem
|
---|
278 | class="username">root</systemitem> user:</para>
|
---|
279 |
|
---|
280 | <screen role="root"><userinput>install -v -m644 /usr/share/mysql/support/my-medium.cnf /etc/my.cnf
|
---|
281 | sed -i 's/^log-bin/#log-bin/' /etc/my.cnf</userinput></screen>
|
---|
282 |
|
---|
283 | <para>You can now install a database and change the ownership to the
|
---|
284 | unprivileged user and group (perform as the <systemitem
|
---|
285 | class="username">root</systemitem> user):</para>
|
---|
286 |
|
---|
287 | <screen role="root"><userinput>mysql_install_db --basedir=/usr --datadir=/srv/mysql --user=mysql &&
|
---|
288 | chgrp -v mysql /srv/mysql{,/test,/mysql}</userinput></screen>
|
---|
289 |
|
---|
290 | <para>Further configuration requires that the
|
---|
291 | <application>MySQL</application> server is running. Start
|
---|
292 | the server using the following commands as the <systemitem
|
---|
293 | class="username">root</systemitem> user:</para>
|
---|
294 |
|
---|
295 | <screen role="root"><userinput>install -v -m755 -o mysql -g mysql -d /var/run/mysql &&
|
---|
296 | mysqld_safe --user=mysql 2>&1 >/dev/null &</userinput></screen>
|
---|
297 |
|
---|
298 | <para>A default installation does not set up a password for the
|
---|
299 | administrator, so use the following command as the <systemitem
|
---|
300 | class="username">root</systemitem> user to set one. Replace
|
---|
301 | <replaceable><new-password></replaceable> with your own.</para>
|
---|
302 |
|
---|
303 | <screen role="root"><userinput>mysqladmin -u root password <replaceable><new-password></replaceable></userinput></screen>
|
---|
304 |
|
---|
305 | <para>Configuration of the server is now finished. Shut the server
|
---|
306 | down using the following command as the <systemitem
|
---|
307 | class="username">root</systemitem> user:</para>
|
---|
308 |
|
---|
309 | <screen role="root"><userinput>mysqladmin -p shutdown</userinput></screen>
|
---|
310 |
|
---|
311 | </sect3>
|
---|
312 |
|
---|
313 | <sect3 id="mysql-init">
|
---|
314 | <title>Boot Script</title>
|
---|
315 |
|
---|
316 | <para>Install the <filename>/etc/rc.d/init.d/mysql</filename> init script
|
---|
317 | included in the <xref linkend="bootscripts"/> package as
|
---|
318 | the <systemitem class="username">root</systemitem> user to start the
|
---|
319 | <application>MySQL</application> server during system boot-up.</para>
|
---|
320 |
|
---|
321 | <indexterm zone="mysql mysql-init">
|
---|
322 | <primary sortas="f-mysql">mysql</primary>
|
---|
323 | </indexterm>
|
---|
324 |
|
---|
325 | <screen role="root"><userinput>make install-mysql</userinput></screen>
|
---|
326 |
|
---|
327 | </sect3>
|
---|
328 |
|
---|
329 | </sect2>
|
---|
330 |
|
---|
331 | <sect2 role="content">
|
---|
332 | <title>Contents</title>
|
---|
333 |
|
---|
334 | <segmentedlist>
|
---|
335 | <segtitle>Installed Programs</segtitle>
|
---|
336 | <segtitle>Installed Libraries</segtitle>
|
---|
337 | <segtitle>Installed Directories</segtitle>
|
---|
338 |
|
---|
339 | <seglistitem>
|
---|
340 | <seg>innochecksum, msql2mysql, my_print_defaults, myisam_ftdump,
|
---|
341 | myisamchk, myisamlog, myisampack, mysql, mysql_client_test,
|
---|
342 | mysql_config, mysql_convert_table_format, mysql_find_rows,
|
---|
343 | mysql_fix_extensions, mysql_install_db, mysql_plugin,
|
---|
344 | mysql_secure_installation, mysql_setpermission, mysql_tzinfo_to_sql,
|
---|
345 | mysql_upgrade, mysql_waitpid, mysql_zap, mysqlaccess, mysqladmin,
|
---|
346 | mysqlbinlog, mysqlbug, mysqlcheck, mysqld, mysqld_multi, mysqld_safe,
|
---|
347 | mysqldump, mysqldumpslow, mysqlhotcopy, mysqlimport, mysqlshow,
|
---|
348 | mysqlslap, mysqltest, perror, replace, resolve_stack_dump and
|
---|
349 | resolveip</seg>
|
---|
350 | <seg>libmysqlclient.{so,a}, libmysqlclient_r.{so,a}, libmysqlservices.a
|
---|
351 | and several in /usr/lib/mysql</seg>
|
---|
352 | <seg>/srv/mysql, /usr/include/mysql, /usr/lib/mysql, /usr/share/mysql and
|
---|
353 | /var/run/mysql</seg>
|
---|
354 | </seglistitem>
|
---|
355 | </segmentedlist>
|
---|
356 |
|
---|
357 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
358 |
|
---|
359 | <para>Descriptions of all the programs and libraries would be several
|
---|
360 | pages long. Instead, consult the <filename>mysql.info</filename>
|
---|
361 | documentation or the on-line reference manual at <ulink
|
---|
362 | url="http://dev.mysql.com/doc/refman/5.5/en/index.html"/>.</para>
|
---|
363 |
|
---|
364 | <para>The <application>Perl</application> DBI modules must be installed
|
---|
365 | for some of the <application>MySQL</application> support programs to
|
---|
366 | function properly.</para>
|
---|
367 |
|
---|
368 | </sect2>
|
---|
369 |
|
---|
370 | </sect1>
|
---|