source: server/databases/mariadb-systemd.xml@ 64135787

kde5-14269
Last change on this file since 64135787 was 64135787, checked in by Xi Ruoyao <xry111@…>, 3 years ago

Begin manually (while modifying stuff) merging trunk and systemd branches since revision 14087.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/branches/kde5@14270 af4574ff-66df-0310-9fd7-8a98e5e911e0

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