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://mysql.mirrors.hoobly.com/Downloads/MySQL-5.0/mysql-&mysql-version;.tar.gz">
|
---|
8 | <!ENTITY mysql-download-ftp "ftp://ftp.fu-berlin.de/unix/databases/mysql/Downloads/MySQL-5.0/mysql-&mysql-version;.tar.gz"> -->
|
---|
9 | <!ENTITY mysql-download-http "&sources-anduin-http;/m/mysql-&mysql-version;.tar.gz">
|
---|
10 | <!ENTITY mysql-download-ftp "&sources-anduin-ftp;/m/mysql-&mysql-version;.tar.gz">
|
---|
11 | <!ENTITY mysql-md5sum "43c11ad3dded693393c4815d24e2b0a5">
|
---|
12 | <!ENTITY mysql-size "23.8 MB">
|
---|
13 | <!ENTITY mysql-buildsize "500 MB (additional 200 MB to run the test suite)">
|
---|
14 | <!ENTITY mysql-time "5.3 SBU (Test suite is an additional 55 minutes, only partially CPU dependent)">
|
---|
15 | ]>
|
---|
16 |
|
---|
17 | <sect1 id="mysql" xreflabel="MySQL-&mysql-version;">
|
---|
18 | <?dbhtml filename="mysql.html"?>
|
---|
19 |
|
---|
20 | <sect1info>
|
---|
21 | <othername>$LastChangedBy$</othername>
|
---|
22 | <date>$Date$</date>
|
---|
23 | </sect1info>
|
---|
24 |
|
---|
25 | <title>MySQL-&mysql-version;</title>
|
---|
26 |
|
---|
27 | <indexterm zone="mysql">
|
---|
28 | <primary sortas="a-MySQL">MySQL</primary>
|
---|
29 | </indexterm>
|
---|
30 |
|
---|
31 | <sect2 role="package">
|
---|
32 | <title>Introduction to MySQL</title>
|
---|
33 |
|
---|
34 | <para><application>MySQL</application> is a widely used and fast SQL
|
---|
35 | database server. It is a client/server implementation that consists of a
|
---|
36 | server daemon and many different client programs and libraries.</para>
|
---|
37 |
|
---|
38 | <para>There may be a more recent release available from the
|
---|
39 | <application>MySQL</application> home page. You can check
|
---|
40 | <ulink url="http://dev.mysql.com/"/> and probably use the
|
---|
41 | existing BLFS instructions. Note that versions other than the one shown
|
---|
42 | in the download URLs have not been tested in a BLFS environment.</para>
|
---|
43 |
|
---|
44 | <para>&lfssvn_checked;20101029&lfssvn_checked2;</para>
|
---|
45 |
|
---|
46 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
47 | <itemizedlist spacing="compact">
|
---|
48 | <listitem>
|
---|
49 | <para>Download (HTTP): <ulink url="&mysql-download-http;"/></para>
|
---|
50 | </listitem>
|
---|
51 | <listitem>
|
---|
52 | <para>Download (FTP): <ulink url="&mysql-download-ftp;"/></para>
|
---|
53 | </listitem>
|
---|
54 | <listitem>
|
---|
55 | <para>Download MD5 sum: &mysql-md5sum;</para>
|
---|
56 | </listitem>
|
---|
57 | <listitem>
|
---|
58 | <para>Download size: &mysql-size;</para>
|
---|
59 | </listitem>
|
---|
60 | <listitem>
|
---|
61 | <para>Estimated disk space required: &mysql-buildsize;</para>
|
---|
62 | </listitem>
|
---|
63 | <listitem>
|
---|
64 | <para>Estimated build time: &mysql-time;</para>
|
---|
65 | </listitem>
|
---|
66 | </itemizedlist>
|
---|
67 |
|
---|
68 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
69 | <itemizedlist spacing="compact">
|
---|
70 | <listitem>
|
---|
71 | <para>Required Patch:
|
---|
72 | <ulink url="&patch-root;/mysql-&mysql-version;-makefile-1.patch"/>
|
---|
73 | </para>
|
---|
74 | </listitem>
|
---|
75 | <listitem>
|
---|
76 | <para>Optional Documentation (see tip below):
|
---|
77 | <ulink url="http://dev.mysql.com/doc/"/>
|
---|
78 | </para>
|
---|
79 | </listitem>
|
---|
80 | </itemizedlist>
|
---|
81 |
|
---|
82 | <bridgehead renderas="sect3">MySQL Dependencies</bridgehead>
|
---|
83 |
|
---|
84 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
85 | <para role="optional"><xref linkend="openssl"/></para>
|
---|
86 |
|
---|
87 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
88 | <para role="optional"><xref linkend="tcpwrappers"/></para>
|
---|
89 |
|
---|
90 | <!-- Removing libedit because it causes more problems than it solves.
|
---|
91 |
|
---|
92 | <ulink url="http://sourceforge.net/projects/libedit/">libedit</ulink>
|
---|
93 | (as an alternative to readline)-->
|
---|
94 |
|
---|
95 | <para condition="html" role="usernotes">User Notes:
|
---|
96 | <ulink url="&blfs-wiki;/mysql"/></para>
|
---|
97 |
|
---|
98 | </sect2>
|
---|
99 |
|
---|
100 | <sect2 role="installation">
|
---|
101 | <title>Installation of MySQL</title>
|
---|
102 |
|
---|
103 | <para>For security reasons, running the server as an unprivileged user
|
---|
104 | and group is strongly encouraged:</para>
|
---|
105 |
|
---|
106 | <screen role="root"><userinput>groupadd -g 40 mysql &&
|
---|
107 | useradd -c "MySQL Server" -d /dev/null -g mysql -s /bin/false \
|
---|
108 | -u 40 mysql</userinput></screen>
|
---|
109 |
|
---|
110 | <note><para>There are a great many options available to
|
---|
111 | <userinput>./configure</userinput>. Check the output of the
|
---|
112 | <option>--help</option> option for additional customization
|
---|
113 | options.</para></note>
|
---|
114 |
|
---|
115 | <para>Build and install <application>MySQL</application> by
|
---|
116 | running the following commands:</para>
|
---|
117 |
|
---|
118 | <screen><userinput>patch -Np1 -i ../mysql-&mysql-version;-makefile-1.patch &&
|
---|
119 | CFLAGS="-O3" \
|
---|
120 | CXX=gcc \
|
---|
121 | CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" \
|
---|
122 | ./configure --prefix=/usr \
|
---|
123 | --sysconfdir=/etc \
|
---|
124 | --libexecdir=/usr/sbin \
|
---|
125 | --localstatedir=/srv/mysql \
|
---|
126 | --enable-thread-safe-client \
|
---|
127 | --enable-assembler \
|
---|
128 | --enable-local-infile \
|
---|
129 | --with-unix-socket-path=/var/run/mysql/mysql.sock \
|
---|
130 | --without-debug \
|
---|
131 | --without-readline \
|
---|
132 | --with-plugins=innobase,myisam \
|
---|
133 | --with-extra-charsets=all \
|
---|
134 | --with-ssl=/usr &&
|
---|
135 | make</userinput></screen>
|
---|
136 |
|
---|
137 | <para>To test the results, issue: <command>make test-force 2>&1 | tee
|
---|
138 | test.log</command>. This forces the test to run to completion and logs all
|
---|
139 | the test output. There will be many tests that are not run due to
|
---|
140 | configuration options and developer considerations. Note that if you use
|
---|
141 | TCP Wrappers and have a restrictive <filename>/etc/hosts.deny</filename>
|
---|
142 | file, you will need to add an appropriate entry to the
|
---|
143 | <filename>/etc/hosts.allow</filename> file for the
|
---|
144 | <command>mysqld</command> daemon. Otherwise many of the tests will
|
---|
145 | fail.</para>
|
---|
146 |
|
---|
147 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
148 |
|
---|
149 | <screen role="root"><userinput>make benchdir_root=/tmp \
|
---|
150 | testroot=/tmp install &&
|
---|
151 | rm -rf /tmp/mysql-test /tmp/sql-bench &&
|
---|
152 | pushd /usr/lib &&
|
---|
153 | ln -v -sf mysql/libmysqlclient{,_r}.so* . &&
|
---|
154 | popd &&
|
---|
155 |
|
---|
156 | pushd /usr/share/info &&
|
---|
157 | rm -v dir &&
|
---|
158 | for FILENAME in *; do
|
---|
159 | install-info $FILENAME dir 2>/dev/null
|
---|
160 | done &&
|
---|
161 | popd</userinput></screen>
|
---|
162 |
|
---|
163 | <tip>
|
---|
164 | <para>The only documentation shipped in the source tarball are
|
---|
165 | <filename>mysql.info</filename> and man pages. You can download various
|
---|
166 | formats of the <application>MySQL</application> Reference Manual
|
---|
167 | from <ulink url="http://dev.mysql.com/doc/"/>.</para>
|
---|
168 | </tip>
|
---|
169 |
|
---|
170 | </sect2>
|
---|
171 |
|
---|
172 | <sect2 role="commands">
|
---|
173 | <title>Command Explanations</title>
|
---|
174 |
|
---|
175 | <para><parameter>CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors
|
---|
176 | -fno-exceptions -fno-rtti"</parameter>: These optimizations are recommended
|
---|
177 | by the developers.</para>
|
---|
178 |
|
---|
179 | <para><parameter>--libexecdir=/usr/sbin</parameter>: This switch installs
|
---|
180 | the <command>mysqld</command> daemon and the
|
---|
181 | <command>mysqlmanager</command> program in an appropriate location.</para>
|
---|
182 |
|
---|
183 | <para><parameter>--localstatedir=/srv/mysql</parameter>: This switch
|
---|
184 | forces <application>MySQL</application> to use
|
---|
185 | <filename class='directory'>/srv/mysql</filename> for database files and
|
---|
186 | other variable data.</para>
|
---|
187 |
|
---|
188 | <para><parameter>--enable-thread-safe-client</parameter>: This
|
---|
189 | switch compiles a thread-safe <application>MySQL</application> client
|
---|
190 | library.</para>
|
---|
191 |
|
---|
192 | <para><parameter>--enable-assembler</parameter>: This switch allows using
|
---|
193 | assembler versions of some string functions.</para>
|
---|
194 |
|
---|
195 | <para><parameter>--enable-local-infile</parameter>: This switch enables
|
---|
196 | the <quote>LOAD DATA INFILE</quote> SQL statement.</para>
|
---|
197 |
|
---|
198 | <para><parameter>--with-unix-socket-path=/var/run/mysql</parameter>:
|
---|
199 | This switch puts the unix-domain socket into the
|
---|
200 | <filename class="directory">/var/run/mysql</filename> directory instead of
|
---|
201 | the default <filename class="directory">/tmp</filename>.</para>
|
---|
202 |
|
---|
203 | <para><parameter>--without-readline</parameter>: This switch forces the
|
---|
204 | build to use the system copy of <application>readline</application> instead
|
---|
205 | of the bundled copy.</para>
|
---|
206 |
|
---|
207 | <para><parameter>--with-extra-charsets=all</parameter>: This switch enables
|
---|
208 | international character sets within the suite.</para>
|
---|
209 |
|
---|
210 | <para><parameter>--with-plugins=innobase,myisam</parameter>: This switch enables
|
---|
211 | two useful table types. Check <command>./configure --help</command> for
|
---|
212 | other table types.</para>
|
---|
213 |
|
---|
214 | <para><parameter>--with-ssl=/usr</parameter>: This switch enables encrypted
|
---|
215 | communication between client and server using OpenSSL.</para>
|
---|
216 |
|
---|
217 | <para><command>make benchdir_root=... install</command>: This installs the
|
---|
218 | benchmark and test suites in a non-system location.</para>
|
---|
219 |
|
---|
220 | <para><command>ln -v -sf mysql/libmysqlclient{,_r}.so* .</command>: This
|
---|
221 | command makes the <application>MySQL</application> shared libraries
|
---|
222 | available to other packages at run-time.</para>
|
---|
223 |
|
---|
224 | <para><option>--with-libwrap</option>: This switch adds tcpwrappers
|
---|
225 | support to <application>MySQL</application>.</para>
|
---|
226 |
|
---|
227 | <para><command>pushd ... popd</command>: This set of commands rebuilds the
|
---|
228 | <filename>/usr/share/info/dir</filename> file as the installation failed
|
---|
229 | to do so.</para>
|
---|
230 |
|
---|
231 | </sect2>
|
---|
232 |
|
---|
233 | <sect2 role="configuration">
|
---|
234 | <title>Configuring MySQL</title>
|
---|
235 |
|
---|
236 | <sect3 id="mysql-config">
|
---|
237 | <title>Config Files</title>
|
---|
238 |
|
---|
239 | <para><filename>/etc/my.cnf</filename> and
|
---|
240 | <filename>~/.my.cnf</filename></para>
|
---|
241 |
|
---|
242 | <indexterm zone="mysql mysql-config">
|
---|
243 | <primary sortas="e-AA.my.cnf">~/.my.cnf</primary>
|
---|
244 | </indexterm>
|
---|
245 |
|
---|
246 | <indexterm zone="mysql mysql-config">
|
---|
247 | <primary sortas="e-etc-my.cnf">/etc/my.cnf</primary>
|
---|
248 | </indexterm>
|
---|
249 |
|
---|
250 | </sect3>
|
---|
251 |
|
---|
252 | <sect3>
|
---|
253 | <title>Configuration Information</title>
|
---|
254 |
|
---|
255 | <para>There are several default configuration files available in
|
---|
256 | <filename class="directory">/usr/share/mysql</filename> which you can
|
---|
257 | use. Create <filename>/etc/my.cnf</filename> using the following command
|
---|
258 | as the <systemitem class="username">root</systemitem> user:</para>
|
---|
259 |
|
---|
260 | <screen role="root"><userinput>install -v -m644 /usr/share/mysql/my-medium.cnf /etc/my.cnf</userinput></screen>
|
---|
261 |
|
---|
262 | <para>You can now install a database and change the ownership to the
|
---|
263 | unprivileged user and group (perform as the <systemitem
|
---|
264 | class="username">root</systemitem> user):</para>
|
---|
265 |
|
---|
266 | <screen role="root"><userinput>mysql_install_db --user=mysql &&
|
---|
267 | chgrp -v mysql /srv/mysql{,/test,/mysql}</userinput></screen>
|
---|
268 |
|
---|
269 | <para>Further configuration requires that the
|
---|
270 | <application>MySQL</application> server is running. Start
|
---|
271 | the server using the following commands as the <systemitem
|
---|
272 | class="username">root</systemitem> user:</para>
|
---|
273 |
|
---|
274 | <screen role="root"><userinput>install -v -m755 -o mysql -g mysql -d /var/run/mysql &&
|
---|
275 | mysqld_safe --user=mysql 2>&1 >/dev/null &</userinput></screen>
|
---|
276 |
|
---|
277 | <para>A default installation does not set up a password for the
|
---|
278 | administrator, so use the following command as the <systemitem
|
---|
279 | class="username">root</systemitem> user to set one. Replace
|
---|
280 | <replaceable><new-password></replaceable> with your own.</para>
|
---|
281 |
|
---|
282 | <screen role="root"><userinput>mysqladmin -u root password <replaceable><new-password></replaceable></userinput></screen>
|
---|
283 |
|
---|
284 | <para>Configuration of the server is now finished. Shut the server
|
---|
285 | down using the following command as the <systemitem
|
---|
286 | class="username">root</systemitem> user:</para>
|
---|
287 |
|
---|
288 | <screen role="root"><userinput>mysqladmin -p shutdown</userinput></screen>
|
---|
289 |
|
---|
290 | </sect3>
|
---|
291 |
|
---|
292 | <sect3 id="mysql-init">
|
---|
293 | <title>Boot Script</title>
|
---|
294 |
|
---|
295 | <para>Install the <filename>/etc/rc.d/init.d/mysql</filename> init script
|
---|
296 | included in the <xref linkend="bootscripts"/> package as
|
---|
297 | the <systemitem class="username">root</systemitem> user to start the
|
---|
298 | <application>MySQL</application> server during system boot-up.</para>
|
---|
299 |
|
---|
300 | <indexterm zone="mysql mysql-init">
|
---|
301 | <primary sortas="f-mysql">mysql</primary>
|
---|
302 | </indexterm>
|
---|
303 |
|
---|
304 | <screen role="root"><userinput>make install-mysql</userinput></screen>
|
---|
305 |
|
---|
306 | </sect3>
|
---|
307 |
|
---|
308 | </sect2>
|
---|
309 |
|
---|
310 | <sect2 role="content">
|
---|
311 | <title>Contents</title>
|
---|
312 |
|
---|
313 | <segmentedlist>
|
---|
314 | <segtitle>Installed Programs</segtitle>
|
---|
315 | <segtitle>Installed Libraries</segtitle>
|
---|
316 | <segtitle>Installed Directories</segtitle>
|
---|
317 |
|
---|
318 | <seglistitem>
|
---|
319 | <seg>comp_err, innochecksum, msql2mysql, my_print_defaults,
|
---|
320 | myisam_ftdump, myisamchk, myisamlog, myisampack, mysql,
|
---|
321 | mysql_client_test, mysql_config, mysql_convert_table_format,
|
---|
322 | mysql_create_system_tables, mysql_explain_log, mysql_find_rows,
|
---|
323 | mysql_fix_extensions, mysql_fix_privilege_tables, mysql_install_db,
|
---|
324 | mysql_secure_installation, mysql_setpermission, mysql_tableinfo,
|
---|
325 | mysql_tzinfo_to_sql, mysql_waitpid, mysql_zap, mysqlaccess, mysqladmin,
|
---|
326 | mysqlbinlog, mysqlbug, mysqlcheck, mysqld, mysqld_multi, mysqld_safe,
|
---|
327 | mysqldump, mysqldumpslow, mysqlhotcopy, mysqlimport, mysqlmanager,
|
---|
328 | mysqlshow, mysqltest, mysqltestmanager, mysqltestmanager-pwgen,
|
---|
329 | mysqltestmanagerc, perror, replace, resolve_stack_dump, and
|
---|
330 | resolveip</seg>
|
---|
331 | <seg>libdbug.a, libheap.a, libmyisam.a, libmyisammrg.a,
|
---|
332 | libmysqlclient.{so,a}, libmysqlclient_r.{so,a}, libmystrings.a,
|
---|
333 | libmysys.a, and libvio.a</seg>
|
---|
334 | <seg>/srv/mysql, /usr/include/mysql, /usr/lib/mysql, /usr/share/mysql, and
|
---|
335 | /var/run/mysql</seg>
|
---|
336 | </seglistitem>
|
---|
337 | </segmentedlist>
|
---|
338 |
|
---|
339 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
340 |
|
---|
341 | <para>Descriptions of all the programs and libraries would be several
|
---|
342 | pages long. Instead, consult the <filename>mysql.info</filename>
|
---|
343 | documentation or the on-line reference manual at <ulink
|
---|
344 | url="http://dev.mysql.com/doc/refman/5.1/en/index.html"/>.</para>
|
---|
345 |
|
---|
346 | <para>The <application>Perl</application> DBI modules must be installed
|
---|
347 | for some of the <application>MySQL</application> support programs to
|
---|
348 | function properly.</para>
|
---|
349 |
|
---|
350 | </sect2>
|
---|
351 |
|
---|
352 | </sect1>
|
---|