source: archive/mysql.xml

trunk
Last change on this file was 3f2db3a6, checked in by Pierre Labastie <pierre.labastie@…>, 17 months ago

Remove sect1info tags

They only contain a date tag that is nowhere used.

  • Property mode set to 100644
File size: 15.3 KB
Line 
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.6/mysql-&mysql-version;.tar.gz">
8 <!ENTITY mysql-download-ftp " ">
9 <!ENTITY mysql-md5sum "1d3d91e8459c719bbef7c97bb499634d">
10 <!ENTITY mysql-size "32 MB">
11 <!ENTITY mysql-buildsize "572 MB (additional 359 MB installed)">
12 <!ENTITY mysql-time "6.3 SBU">
13]>
14
15<sect1 id="mysql" xreflabel="MySQL-&mysql-version;">
16 <?dbhtml filename="mysql.html"?>
17
18
19 <title>MySQL-&mysql-version;</title>
20
21 <indexterm zone="mysql">
22 <primary sortas="a-MySQL">MySQL</primary>
23 </indexterm>
24
25 <sect2 role="package">
26 <title>Introduction to MySQL</title>
27
28 <para>
29 <application>MySQL</application> is a widely used and fast SQL database
30 server. It is a client/server implementation that consists of a
31 server daemon and many different client programs and libraries.
32 </para>
33
34 &lfs75_checked;
35
36 <bridgehead renderas="sect3">Package Information</bridgehead>
37 <itemizedlist spacing="compact">
38 <listitem>
39 <para>
40 Download (HTTP): <ulink url="&mysql-download-http;"/>
41 </para>
42 </listitem>
43 <listitem>
44 <para>
45 Download (FTP): <ulink url="&mysql-download-ftp;"/>
46 </para>
47 </listitem>
48 <listitem>
49 <para>
50 Download MD5 sum: &mysql-md5sum;
51 </para>
52 </listitem>
53 <listitem>
54 <para>
55 Download size: &mysql-size;
56 </para>
57 </listitem>
58 <listitem>
59 <para>
60 Estimated disk space required: &mysql-buildsize;
61 </para>
62 </listitem>
63 <listitem>
64 <para>
65 Estimated build time: &mysql-time;
66 </para>
67 </listitem>
68 </itemizedlist>
69
70 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
71 <itemizedlist spacing="compact">
72 <listitem>
73 <para>
74 Optional patch (recommended if building for Amarok):
75 <ulink url="&patch-root;/mysql-&mysql-version;-embedded_library_shared-1.patch"/>
76 </para>
77 </listitem>
78 <listitem>
79 <para>
80 Optional Documentation (see tip below):
81 <ulink url="http://dev.mysql.com/doc/"/>
82 </para>
83 </listitem>
84 </itemizedlist>
85
86 <bridgehead renderas="sect3">MySQL Dependencies</bridgehead>
87
88 <bridgehead renderas="sect4">Required</bridgehead>
89 <para role="required">
90 <xref linkend="cmake"/>
91 </para>
92
93 <bridgehead renderas="sect4">Recommended</bridgehead>
94 <para role="recommended">
95 <xref linkend="libevent"/> and
96 <xref linkend="openssl"/>
97 </para>
98
99 <bridgehead renderas="sect4">Optional</bridgehead>
100 <para role="optional">
101 <ulink url="http://packages.debian.org/source/sid/libaio">libaio</ulink> and
102 <ulink url="http://www.thrysoee.dk/editline/">libedit</ulink>
103 </para>
104
105 <para condition="html" role="usernotes">User Notes:
106 <ulink url="&blfs-wiki;/mysql"/>
107 </para>
108 </sect2>
109
110 <sect2 role="installation">
111 <title>Installation of MySQL</title>
112
113 <para>
114 For security reasons, running the server as an unprivileged user
115 and group is strongly encouraged. Issue the following (as
116 <systemitem class="username">root</systemitem>) to create the
117 user and group:
118 </para>
119
120<screen role="root"><userinput>groupadd -g 40 mysql &amp;&amp;
121useradd -c "MySQL Server" -d /srv/mysql -g mysql -s /bin/false -u 40 mysql</userinput></screen>
122
123 <para>
124 If the MySQL server is not needed, it is possible to build only the
125 client libraries of MySQL. To do this you need to add
126 <parameter>-DWITHOUT_SERVER=ON</parameter> to the <command>cmake</command>
127 command below.
128 </para>
129
130 <para>
131 MySQL contains an embedded server library. By default, it is built as a
132 statically linked library, <filename>libmysqld.a</filename>, but by
133 applying the optional patch, a shared version of this library can be built.
134 The library is needed by certain applications, such as
135 <application>Amarok</application> and it is recommend to use the shared
136 libraries whenever it is possible.
137 </para>
138
139 <para>
140 There are numerous options available to
141 <command>cmake</command>. Check the output of the `<command>cmake .
142 -LH</command>` for additional customization options. See the <ulink
143 url="http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html">
144 MySQL Documentation</ulink> for a full listing of all options.
145 </para>
146
147 <para>
148 If you want to build shared version of the embedded server library, apply
149 the following patch:
150 </para>
151
152<screen><userinput>patch -Np1 -i ../mysql-&mysql-version;-embedded_library_shared-1.patch</userinput></screen>
153
154 <para>
155 Install <application>MySQL</application> by running the
156 following commands:
157 </para>
158
159<screen><userinput>sed -i "/ADD_SUBDIRECTORY(sql\/share)/d" CMakeLists.txt &amp;&amp;
160sed -i "s/ADD_SUBDIRECTORY(libmysql)/&amp;\\nADD_SUBDIRECTORY(sql\/share)/" CMakeLists.txt &amp;&amp;
161sed -i "s@data/test@\${INSTALL_MYSQLSHAREDIR}@g" sql/CMakeLists.txt &amp;&amp;
162sed -i "s@data/mysql@\${INSTALL_MYSQLTESTDIR}@g" sql/CMakeLists.txt &amp;&amp;
163
164sed -i "s/srv_buf_size/srv_sort_buf_size/" storage/innobase/row/row0log.cc &amp;&amp;
165
166mkdir build &amp;&amp;
167cd build &amp;&amp;
168
169cmake -DCMAKE_BUILD_TYPE=Release \
170 -DCMAKE_INSTALL_PREFIX=/usr \
171 -DINSTALL_DOCDIR=share/doc/mysql \
172 -DINSTALL_DOCREADMEDIR=share/doc/mysql \
173 -DINSTALL_INCLUDEDIR=include/mysql \
174 -DINSTALL_INFODIR=share/info \
175 -DINSTALL_MANDIR=share/man \
176 -DINSTALL_MYSQLDATADIR=/srv/mysql \
177 -DINSTALL_MYSQLSHAREDIR=share/mysql \
178 -DINSTALL_MYSQLTESTDIR=share/mysql/test \
179 -DINSTALL_PLUGINDIR=lib/mysql/plugin \
180 -DINSTALL_SBINDIR=sbin \
181 -DINSTALL_SCRIPTDIR=bin \
182 -DINSTALL_SQLBENCHDIR=share/mysql/bench \
183 -DINSTALL_SUPPORTFILESDIR=share/mysql \
184 -DMYSQL_DATADIR=/srv/mysql \
185 -DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock \
186 -DSYSCONFDIR=/etc/mysql \
187 -DWITH_PERFSCHEMA_STORAGE_ENGINE=OFF \
188 -DWITH_EXTRA_CHARSETS=complex \
189 -DWITH_LIBEVENT=system \
190 -DWITH_SSL=system \
191 .. &amp;&amp;
192make</userinput></screen>
193
194 <para>
195 To test the results, issue: <command>make test</command>.
196 </para>
197
198 <para>
199 Now, as the <systemitem class="username">root</systemitem> user:
200 </para>
201
202<screen role="root"><userinput>make install</userinput></screen>
203
204 <tip>
205 <para>
206 The only documentation shipped in the source tarball are
207 <filename>mysql.info</filename> and man pages. You can download
208 various formats of the <application>MySQL</application>
209 Reference Manual from <ulink url="http://dev.mysql.com/doc/"/>.
210 </para>
211 </tip>
212
213 </sect2>
214
215 <sect2 role="commands">
216 <title>Command Explanations</title>
217
218 <para>
219 <command>sed -i ...</command>: First two seds fix client-only builds.
220 Following two seds set correct installation directories for some
221 components. Last one fixes a bug in the code.
222 </para>
223
224 <para>
225 <parameter>-DWITHOUT_SERVER=ON</parameter>: Use this switch if you don't
226 want the server and would like to build the client only.
227 </para>
228
229 <para>
230 <parameter>-DWITH_EXTRA_CHARSETS=complex</parameter>: This switch enables
231 support for the complex character sets.
232 </para>
233
234 <para>
235 <parameter>-DWITH_LIBEVENT=system</parameter>: This switch is used to
236 tell the build system to use installed <application>libevent</application>.
237 Remove it if you didn't install <application>libevent</application>.
238 </para>
239
240 <para>
241 <parameter>-DWITH_SSL=system</parameter>: This switch is used to tell the
242 build system to use installed <application>OpenSSL</application>. Remove
243 it if you didn't install <application>OpenSSL</application>.
244 </para>
245
246 </sect2>
247
248 <sect2 role="configuration">
249 <title>Configuring MySQL</title>
250
251 <sect3 id="mysql-config">
252 <title>Config Files</title>
253
254 <para>
255 <filename>/etc/mysql/my.cnf</filename> and
256 <filename>~/.my.cnf</filename>
257 </para>
258
259 <indexterm zone="mysql mysql-config">
260 <primary sortas="e-AA.my.cnf">~/.my.cnf</primary>
261 </indexterm>
262
263 <indexterm zone="mysql mysql-config">
264 <primary sortas="e-etc-mysql-my.cnf">/etc/mysql/my.cnf</primary>
265 </indexterm>
266
267 </sect3>
268
269 <sect3>
270 <title>Configuration Information</title>
271
272 <note>
273 <para>
274 If you are upgrading from previous major version of
275 <application>MySQL</application>, be sure to consult
276 the <ulink
277 url="https://dev.mysql.com/doc/refman/5.6/en/upgrading-from-previous-series.html">
278 MySQL Reference Manual</ulink> for notes on
279 upgrading the software.
280 </para>
281 </note>
282
283 <para>
284 Create basic <filename>/etc/mysql/my.cnf</filename>
285 using the following command as the <systemitem
286 class="username">root</systemitem> user:
287 </para>
288
289<screen role="root"><userinput>install -v -dm 755 /etc/mysql &amp;&amp;
290cat &gt; /etc/mysql/my.cnf &lt;&lt; "EOF"
291<literal># Begin /etc/mysql/my.cnf
292
293# The following options will be passed to all MySQL clients
294[client]
295#password = your_password
296port = 3306
297socket = /run/mysqld/mysqld.sock
298
299# The MySQL server
300[mysqld]
301port = 3306
302socket = /run/mysqld/mysqld.sock
303datadir = /srv/mysql
304skip-external-locking
305key_buffer_size = 16M
306max_allowed_packet = 1M
307sort_buffer_size = 512K
308net_buffer_length = 16K
309myisam_sort_buffer_size = 8M
310
311# Don't listen on a TCP/IP port at all.
312skip-networking
313
314# required unique id between 1 and 2^32 - 1
315server-id = 1
316
317# Uncomment the following if you are using BDB tables
318#bdb_cache_size = 4M
319#bdb_max_lock = 10000
320
321# Uncomment the following if you are using InnoDB tables
322#innodb_data_home_dir = /srv/mysql
323#innodb_data_file_path = ibdata1:10M:autoextend
324#innodb_log_group_home_dir = /srv/mysql
325# You can set .._buffer_pool_size up to 50 - 80 %
326# of RAM but beware of setting memory usage too high
327#innodb_buffer_pool_size = 16M
328#innodb_additional_mem_pool_size = 2M
329# Set .._log_file_size to 25 % of buffer pool size
330#innodb_log_file_size = 5M
331#innodb_log_buffer_size = 8M
332#innodb_flush_log_at_trx_commit = 1
333#innodb_lock_wait_timeout = 50
334
335[mysqldump]
336quick
337max_allowed_packet = 16M
338
339[mysql]
340no-auto-rehash
341# Remove the next comment character if you are not familiar with SQL
342#safe-updates
343
344[isamchk]
345key_buffer = 20M
346sort_buffer_size = 20M
347read_buffer = 2M
348write_buffer = 2M
349
350[myisamchk]
351key_buffer_size = 20M
352sort_buffer_size = 20M
353read_buffer = 2M
354write_buffer = 2M
355
356[mysqlhotcopy]
357interactive-timeout
358
359# End /etc/mysql/my.cnf</literal>
360EOF</userinput></screen>
361
362 <para>
363 You can now install a database and change the ownership to the
364 unprivileged user and group (perform as the <systemitem
365 class="username">root</systemitem> user):
366 </para>
367
368<screen role="root"><userinput>mysql_install_db --basedir=/usr --datadir=/srv/mysql --user=mysql &amp;&amp;
369chown -R mysql:mysql /srv/mysql</userinput></screen>
370
371 <para>
372 Further configuration requires that the
373 <application>MySQL</application> server is running. Start
374 the server using the following commands as the <systemitem
375 class="username">root</systemitem> user:
376 </para>
377
378<screen role="root"><userinput>install -v -m755 -o mysql -g mysql -d /run/mysqld &amp;&amp;
379mysqld_safe --user=mysql 2&gt;&amp;1 &gt;/dev/null &amp;</userinput></screen>
380
381 <para>
382 A default installation does not set up a password for the
383 administrator, so use the following command as the <systemitem
384 class="username">root</systemitem> user to set one. Replace
385 <replaceable>&lt;new-password&gt;</replaceable> with your own.
386 </para>
387
388<screen role="root"><userinput>mysqladmin -u root password <replaceable>&lt;new-password&gt;</replaceable></userinput></screen>
389
390 <para>
391 Configuration of the server is now finished. Shut the server
392 down using the following command as the <systemitem
393 class="username">root</systemitem> user:
394 </para>
395
396<screen role="root"><userinput>mysqladmin -p shutdown</userinput></screen>
397
398 </sect3>
399
400 <sect3 id="mysql-init">
401 <title>Boot Script</title>
402
403 <para>
404 Install the <filename>/etc/rc.d/init.d/mysql</filename> init script
405 included in the <xref linkend="bootscripts"/> package as
406 the <systemitem class="username">root</systemitem> user to start the
407 <application>MySQL</application> server during system boot-up.
408 </para>
409
410 <indexterm zone="mysql mysql-init">
411 <primary sortas="f-mysql">mysql</primary>
412 </indexterm>
413
414<screen role="root"><userinput>make install-mysql</userinput></screen>
415
416 </sect3>
417
418 </sect2>
419
420 <sect2 role="content">
421 <title>Contents</title>
422
423 <segmentedlist>
424 <segtitle>Installed Programs</segtitle>
425 <segtitle>Installed Libraries</segtitle>
426 <segtitle>Installed Directories</segtitle>
427
428 <seglistitem>
429 <seg>
430 innochecksum, msql2mysql, myisamchk, myisam_ftdump, myisamlog,
431 myisampack, my_print_defaults, mysql, mysqlaccess, mysqlaccess.conf,
432 mysqladmin, mysqlbinlog, mysqlbug, mysqlcheck, mysql_client_test,
433 mysql_client_test_embedded, mysql_config, mysql_config_editor,
434 mysql_convert_table_format, mysqld, mysqld_multi, mysqld_safe, mysqldump,
435 mysqldumpslow, mysql_embedded, mysql_find_rows, mysql_fix_extensions,
436 mysqlhotcopy, mysqlimport, mysql_install_db, mysql_plugin,
437 mysql_secure_installation, mysql_setpermission, mysqlshow, mysqlslap,
438 mysqltest, mysqltest_embedded, mysql_tzinfo_to_sql, mysql_upgrade,
439 mysql_waitpid, mysql_zap, perror, replace, resolveip and
440 resolve_stack_dump
441 </seg>
442 <seg>
443 libmysqlclient.{so,a}, libmysqlclient_r.{so,a}, libmysqld.{so,a},
444 libmysqlservices.a and several under /usr/lib/mysql/plugin/
445 </seg>
446 <seg>
447 /etc/mysql,
448 /srv/mysql,
449 /usr/include/mysql,
450 /usr/lib/mysql,
451 /usr/share/doc/mysql and
452 /usr/share/mysql
453 </seg>
454 </seglistitem>
455 </segmentedlist>
456
457 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
458
459 <para>
460 Descriptions of all the programs and libraries would be several
461 pages long. Instead, consult the <filename>mysql.info</filename>
462 documentation or the on-line reference manual at <ulink
463 url="http://dev.mysql.com/doc/refman/5.6/en/index.html"/>.
464 </para>
465
466 <para>
467 The <application>Perl</application> DBI modules must be installed
468 for some of the <application>MySQL</application> support programs to
469 function properly.
470 </para>
471
472 </sect2>
473
474</sect1>
Note: See TracBrowser for help on using the repository browser.