source: server/databases/mysql.xml@ 4890200

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 4890200 was 4890200, checked in by Krejzi <krejzi@…>, 11 years ago

Packages updates and fixes.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@11157 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 15.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 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 "9241be729964ab4594de11baa30aec48">
10 <!ENTITY mysql-size "34 MB">
11 <!ENTITY mysql-buildsize "1.0 GB">
12 <!ENTITY mysql-time "4.5 SBU">
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 &lfs73_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="libevent"/> and
100 <xref linkend="openssl"/>
101 </para>
102
103 <bridgehead renderas="sect4">Optional</bridgehead>
104 <para role="optional">
105 <ulink url="http://packages.debian.org/source/sid/libaio">libaio</ulink> and
106 <ulink url="http://www.thrysoee.dk/editline/">libedit</ulink>
107 </para>
108
109 <para condition="html" role="usernotes">User Notes:
110 <ulink url="&blfs-wiki;/mysql"/>
111 </para>
112 </sect2>
113
114 <sect2 role="installation">
115 <title>Installation of MySQL</title>
116
117 <para>
118 For security reasons, running the server as an unprivileged user
119 and group is strongly encouraged. Issue the following (as
120 <systemitem class="username">root</systemitem>) to create the
121 user and group:
122 </para>
123
124<screen role="root"><userinput>groupadd -g 40 mysql &amp;&amp;
125useradd -c "MySQL Server" -d /srv/mysql -g mysql -s /bin/false -u 40 mysql</userinput></screen>
126
127 <para>
128 If the MySQL server is not needed, it is possible to build only the
129 client libraries of MySQL. To do this you need to add
130 <parameter>-DWITHOUT_SERVER=ON</parameter> to the <command>cmake</command>
131 command below.
132 </para>
133
134 <para>
135 MySQL contains an embedded server library. By default, it is built as a
136 statically linked library, <filename>libmysqld.a</filename>, but by
137 applying the optional patch, a shared version of this library can be built.
138 The library is needed by certain applications, such as
139 <application>Amarok</application> and it is recommend to use the shared
140 libraries whenever it is possible.
141 </para>
142
143 <para>
144 There are numerous options available to
145 <command>cmake</command>. Check the output of the `<command>cmake .
146 -LH</command>` for additional customization options. See the <ulink
147 url="http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html">
148 MySQL Documentation</ulink> for a full listing of all options.
149 </para>
150
151 <para>
152 If you want to build shared version of the embedded server library, apply
153 the following patch:
154 </para>
155
156<screen><userinput>patch -Np1 -i ../mysql-&mysql-version;-embedded_library_shared-1.patch</userinput></screen>
157
158 <para>
159 Install <application>MySQL</application> by running the
160 following commands:
161 </para>
162
163<screen><userinput>sed -i "/ADD_SUBDIRECTORY(sql\/share)/d" CMakeLists.txt &amp;&amp;
164sed -i "s/ADD_SUBDIRECTORY(libmysql)/&amp;\\nADD_SUBDIRECTORY(sql\/share)/" CMakeLists.txt &amp;&amp;
165sed -i "s@data/test@\${INSTALL_MYSQLSHAREDIR}@g" sql/CMakeLists.txt &amp;&amp;
166sed -i "s@data/mysql@\${INSTALL_MYSQLTESTDIR}@g" sql/CMakeLists.txt &amp;&amp;
167mkdir build &amp;&amp;
168cd build &amp;&amp;
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 \
180 -DINSTALL_SBINDIR=sbin \
181 -DINSTALL_SCRIPTDIR=bin \
182 -DINSTALL_SQLBENCHDIR=share/mysql/bench \
183 -DINSTALL_SUPPORTFILESDIR=share/mysql/support \
184 -DMYSQL_DATADIR=/srv/mysql \
185 -DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock \
186 -DSYSCONFDIR=/etc/mysql \
187 -DWITH_PARTITION_STORAGE_ENGINE=OFF \
188 -DWITH_PERFSCHEMA_STORAGE_ENGINE=OFF \
189 -DWITH_EXTRA_CHARSETS=complex \
190 -DWITH_LIBEVENT=system \
191 -DWITH_SSL=system \
192 .. &amp;&amp;
193make</userinput></screen>
194
195 <para>
196 To test the results, issue: <command>make test</command>.
197 </para>
198
199 <para>
200 Now, as the <systemitem class="username">root</systemitem> user:
201 </para>
202
203<screen role="root"><userinput>make install</userinput></screen>
204
205 <tip>
206 <para>
207 The only documentation shipped in the source tarball are
208 <filename>mysql.info</filename> and man pages. You can download
209 various formats of the <application>MySQL</application>
210 Reference Manual from <ulink url="http://dev.mysql.com/doc/"/>.
211 </para>
212 </tip>
213
214 </sect2>
215
216 <sect2 role="commands">
217 <title>Command Explanations</title>
218
219 <para>
220 <command>sed -i ...</command>: First two seds fix client-only builds. Last
221 two seds set correct installation directories for some components.
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>cat &gt; /etc/mysql/my.cnf &lt;&lt; "EOF"
290<literal># Begin /etc/mysql/my.cnf
291
292# The following options will be passed to all MySQL clients
293[client]
294#password = your_password
295port = 3306
296socket = /run/mysqld/mysqld.sock
297
298# The MySQL server
299[mysqld]
300port = 3306
301socket = /run/mysqld/mysqld.sock
302datadir = /srv/mysql
303skip-external-locking
304key_buffer = 16M
305max_allowed_packet = 1M
306sort_buffer_size = 512K
307net_buffer_length = 16K
308myisam_sort_buffer_size = 8M
309
310# Don't listen on a TCP/IP port at all.
311skip-networking
312
313# required unique id between 1 and 2^32 - 1
314server-id = 1
315
316# Uncomment the following if you are using BDB tables
317#bdb_cache_size = 4M
318#bdb_max_lock = 10000
319
320# Uncomment the following if you are using InnoDB tables
321#innodb_data_home_dir = /srv/mysql
322#innodb_data_file_path = ibdata1:10M:autoextend
323#innodb_log_group_home_dir = /srv/mysql
324# You can set .._buffer_pool_size up to 50 - 80 %
325# of RAM but beware of setting memory usage too high
326#innodb_buffer_pool_size = 16M
327#innodb_additional_mem_pool_size = 2M
328# Set .._log_file_size to 25 % of buffer pool size
329#innodb_log_file_size = 5M
330#innodb_log_buffer_size = 8M
331#innodb_flush_log_at_trx_commit = 1
332#innodb_lock_wait_timeout = 50
333
334[mysqldump]
335quick
336max_allowed_packet = 16M
337
338[mysql]
339no-auto-rehash
340# Remove the next comment character if you are not familiar with SQL
341#safe-updates
342
343[isamchk]
344key_buffer = 20M
345sort_buffer_size = 20M
346read_buffer = 2M
347write_buffer = 2M
348
349[myisamchk]
350key_buffer_size = 20M
351sort_buffer_size = 20M
352read_buffer = 2M
353write_buffer = 2M
354
355[mysqlhotcopy]
356interactive-timeout
357
358# End /etc/mysql/my.cnf</literal>
359EOF</userinput></screen>
360
361 <para>
362 You can now install a database and change the ownership to the
363 unprivileged user and group (perform as the <systemitem
364 class="username">root</systemitem> user):
365 </para>
366
367<screen role="root"><userinput>mysql_install_db --basedir=/usr --datadir=/srv/mysql --user=mysql &amp;&amp;
368chown -R mysql:mysql /srv/mysql</userinput></screen>
369
370 <para>
371 Further configuration requires that the
372 <application>MySQL</application> server is running. Start
373 the server using the following commands as the <systemitem
374 class="username">root</systemitem> user:
375 </para>
376
377<screen role="root"><userinput>install -v -m755 -o mysql -g mysql -d /var/run/mysqld &amp;&amp;
378mysqld_safe --user=mysql 2&gt;&amp;1 &gt;/dev/null &amp;</userinput></screen>
379
380 <para>
381 A default installation does not set up a password for the
382 administrator, so use the following command as the <systemitem
383 class="username">root</systemitem> user to set one. Replace
384 <replaceable>&lt;new-password&gt;</replaceable> with your own.
385 </para>
386
387<screen role="root"><userinput>mysqladmin -u root password <replaceable>&lt;new-password&gt;</replaceable></userinput></screen>
388
389 <para>
390 Configuration of the server is now finished. Shut the server
391 down using the following command as the <systemitem
392 class="username">root</systemitem> user:
393 </para>
394
395<screen role="root"><userinput>mysqladmin -p shutdown</userinput></screen>
396
397 </sect3>
398
399 <sect3 id="mysql-init">
400 <title>Boot Script</title>
401
402 <para>
403 Install the <filename>/etc/rc.d/init.d/mysql</filename> init script
404 included in the <xref linkend="bootscripts"/> package as
405 the <systemitem class="username">root</systemitem> user to start the
406 <application>MySQL</application> server during system boot-up.
407 </para>
408
409 <indexterm zone="mysql mysql-init">
410 <primary sortas="f-mysql">mysql</primary>
411 </indexterm>
412
413<screen role="root"><userinput>make install-mysql</userinput></screen>
414
415 </sect3>
416
417 </sect2>
418
419 <sect2 role="content">
420 <title>Contents</title>
421
422 <segmentedlist>
423 <segtitle>Installed Programs</segtitle>
424 <segtitle>Installed Libraries</segtitle>
425 <segtitle>Installed Directories</segtitle>
426
427 <seglistitem>
428 <seg>
429 innochecksum, msql2mysql, myisamchk, myisam_ftdump, myisamlog,
430 myisampack, my_print_defaults, mysql, mysqlaccess, mysqlaccess.conf,
431 mysqladmin, mysqlbinlog, mysqlbug, mysqlcheck, mysql_client_test,
432 mysql_client_test_embedded, mysql_config, mysql_config_editor,
433 mysql_convert_table_format, mysqld, mysqld_multi, mysqld_safe, mysqldump,
434 mysqldumpslow, mysql_embedded, mysql_find_rows, mysql_fix_extensions,
435 mysqlhotcopy, mysqlimport, mysql_install_db, mysql_plugin,
436 mysql_secure_installation, mysql_setpermission, mysqlshow, mysqlslap,
437 mysqltest, mysqltest_embedded, mysql_tzinfo_to_sql, mysql_upgrade,
438 mysql_waitpid, mysql_zap, perror, replace, resolveip and
439 resolve_stack_dump
440 </seg>
441 <seg>
442 libmysqlclient.{so,a}, libmysqlclient_r.{so,a}, libmysqld.{so,a} and
443 libmysqlservices.a
444 </seg>
445 <seg>
446 /etc/mysql,
447 /srv/mysql,
448 /usr/include/mysql,
449 /usr/lib/mysql,
450 /usr/share/doc/mysql and
451 /usr/share/mysql
452 </seg>
453 </seglistitem>
454 </segmentedlist>
455
456 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
457
458 <para>
459 Descriptions of all the programs and libraries would be several
460 pages long. Instead, consult the <filename>mysql.info</filename>
461 documentation or the on-line reference manual at <ulink
462 url="http://dev.mysql.com/doc/refman/5.6/en/index.html"/>.
463 </para>
464
465 <para>
466 The <application>Perl</application> DBI modules must be installed
467 for some of the <application>MySQL</application> support programs to
468 function properly.
469 </para>
470
471 </sect2>
472
473</sect1>
Note: See TracBrowser for help on using the repository browser.