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