[08254fc] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[6732c094] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[08254fc] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
[68196987] | 6 |
|
---|
[d0151ee] | 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">
|
---|
[9c98f0e] | 11 | <!ENTITY mysql-md5sum "b658e58887a74dce65224ae0fc8ee06a">
|
---|
| 12 | <!ENTITY mysql-size "28 MB">
|
---|
| 13 | <!ENTITY mysql-buildsize "386 MB (additional 250 MB to run the test suite)">
|
---|
| 14 | <!ENTITY mysql-time "5.1 SBU (Test suite is an additional 100 minutes, only partially CPU dependent)">
|
---|
[08254fc] | 15 | ]>
|
---|
| 16 |
|
---|
[c30b739] | 17 | <sect1 id="mysql" xreflabel="MySQL-&mysql-version;">
|
---|
[22c7fe6] | 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 |
|
---|
[d0151ee] | 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 |
|
---|
[22c7fe6] | 44 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 45 | <itemizedlist spacing="compact">
|
---|
| 46 | <listitem>
|
---|
| 47 | <para>Download (HTTP): <ulink url="&mysql-download-http;"/></para>
|
---|
| 48 | </listitem>
|
---|
| 49 | <listitem>
|
---|
| 50 | <para>Download (FTP): <ulink url="&mysql-download-ftp;"/></para>
|
---|
| 51 | </listitem>
|
---|
| 52 | <listitem>
|
---|
| 53 | <para>Download MD5 sum: &mysql-md5sum;</para>
|
---|
| 54 | </listitem>
|
---|
| 55 | <listitem>
|
---|
| 56 | <para>Download size: &mysql-size;</para>
|
---|
| 57 | </listitem>
|
---|
| 58 | <listitem>
|
---|
| 59 | <para>Estimated disk space required: &mysql-buildsize;</para>
|
---|
| 60 | </listitem>
|
---|
| 61 | <listitem>
|
---|
| 62 | <para>Estimated build time: &mysql-time;</para>
|
---|
| 63 | </listitem>
|
---|
| 64 | </itemizedlist>
|
---|
| 65 |
|
---|
[9c98f0e] | 66 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
| 67 | <itemizedlist spacing="compact">
|
---|
| 68 | <listitem>
|
---|
| 69 | <para>Required Patch: <ulink
|
---|
[6a07e73] | 70 | url="&patch-root;/mysql-&mysql-version;-limit_test-1.patch"/></para>
|
---|
[9c98f0e] | 71 | </listitem>
|
---|
| 72 | </itemizedlist>
|
---|
| 73 |
|
---|
| 74 |
|
---|
[1e11f8e] | 75 | <bridgehead renderas="sect3">MySQL Dependencies</bridgehead>
|
---|
[22c7fe6] | 76 |
|
---|
| 77 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[9b603d4] | 78 | <para role="optional"><xref linkend="openssl"/> and
|
---|
[039736d2] | 79 | <xref linkend="tcpwrappers"/>
|
---|
[9f12e36] | 80 |
|
---|
[9b603d4] | 81 | <!-- Removing libedit because it causes more problems than it solves.
|
---|
[9f12e36] | 82 |
|
---|
[22c7fe6] | 83 | <ulink url="http://sourceforge.net/projects/libedit/">libedit</ulink>
|
---|
[9b603d4] | 84 | (as an alternative to readline)-->
|
---|
[9f12e36] | 85 |
|
---|
[9b603d4] | 86 | </para>
|
---|
[9dfd852b] | 87 |
|
---|
[3cb0c57] | 88 | <para condition="html" role="usernotes">User Notes:
|
---|
| 89 | <ulink url="&blfs-wiki;/mysql"/></para>
|
---|
| 90 |
|
---|
[22c7fe6] | 91 | </sect2>
|
---|
| 92 |
|
---|
| 93 | <sect2 role="installation">
|
---|
| 94 | <title>Installation of MySQL</title>
|
---|
| 95 |
|
---|
| 96 | <para>For security reasons, running the server as an unprivileged user
|
---|
| 97 | and group is strongly encouraged:</para>
|
---|
| 98 |
|
---|
[b785ab29] | 99 | <screen role="root"><userinput>groupadd -g 40 mysql &&
|
---|
| 100 | useradd -c "MySQL Server" -d /dev/null -g mysql -s /bin/false \
|
---|
| 101 | -u 40 mysql</userinput></screen>
|
---|
[22c7fe6] | 102 |
|
---|
[9c98f0e] | 103 | <note><para>There are a great many options available to
|
---|
| 104 | <userinput>./configure</userinput>. Check the output of the
|
---|
| 105 | <option>--help</option> option for additional customization
|
---|
| 106 | options.</para></note>
|
---|
| 107 |
|
---|
[22c7fe6] | 108 | <para>Build and install <application>MySQL</application> by
|
---|
| 109 | running the following commands:</para>
|
---|
| 110 |
|
---|
[be981a56] | 111 | <screen><userinput>patch -Np1 -i ../mysql-&mysql-version;-limit_test-1.patch &&
|
---|
[9b603d4] | 112 | ./configure --prefix=/usr \
|
---|
[9dfd852b] | 113 | --sysconfdir=/etc \
|
---|
| 114 | --libexecdir=/usr/sbin \
|
---|
| 115 | --localstatedir=/srv/mysql \
|
---|
| 116 | --enable-thread-safe-client \
|
---|
| 117 | --enable-assembler \
|
---|
| 118 | --enable-local-infile \
|
---|
| 119 | --with-unix-socket-path=/var/run/mysql/mysql.sock \
|
---|
| 120 | --without-debug \
|
---|
[9b603d4] | 121 | --without-readline \
|
---|
[9c98f0e] | 122 | --with-plugins=innobase,myisam \
|
---|
| 123 | --with-extra-charsets=all \
|
---|
| 124 | --with-ssl &&
|
---|
| 125 | make</userinput></screen>
|
---|
[68196987] | 126 |
|
---|
| 127 | <para>To test the results, issue: <command>make test</command>. Note that
|
---|
| 128 | if you have a restrictive <filename>/etc/hosts.deny</filename> file, you
|
---|
| 129 | will need to add an appropriate entry to the
|
---|
| 130 | <filename>/etc/hosts.allow</filename> file for the
|
---|
[9c98f0e] | 131 | <command>mysqld</command> daemon. Otherwise many of the tests will fail.</para>
|
---|
[9e69cae] | 132 |
|
---|
[22c7fe6] | 133 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[20f5e71a] | 134 |
|
---|
[9c98f0e] | 135 | <screen role="root"><userinput>make benchdir_root=/tmp/mysql-bench install &&
|
---|
[9dfd852b] | 136 | rm -rf /tmp/mysql &&
|
---|
[4b93ac2] | 137 | cd /usr/lib &&
|
---|
[22c7fe6] | 138 | ln -v -sf mysql/libmysqlclient{,_r}.so* .</userinput></screen>
|
---|
[4b93ac2] | 139 |
|
---|
[039736d2] | 140 | <tip>
|
---|
| 141 | <para>The only documentation shipped in the source tarball are
|
---|
| 142 | <filename>mysql.info</filename> and <filename>manual.chm</filename>
|
---|
| 143 | (Microsoft Help format) files. You can download various formats of the
|
---|
| 144 | <application>MySQL</application> Reference Manual from <ulink
|
---|
| 145 | url="http://dev.mysql.com/doc/"/>.</para>
|
---|
| 146 | </tip>
|
---|
[36769b3] | 147 |
|
---|
[22c7fe6] | 148 | </sect2>
|
---|
[4b93ac2] | 149 |
|
---|
[22c7fe6] | 150 | <sect2 role="commands">
|
---|
| 151 | <title>Command Explanations</title>
|
---|
[08254fc] | 152 |
|
---|
[22c7fe6] | 153 | <para><parameter>--libexecdir=/usr/sbin</parameter>: This switch installs
|
---|
[9dfd852b] | 154 | the <command>mysqld</command> daemon and the
|
---|
| 155 | <command>mysqlmanager</command> program in an appropriate location.</para>
|
---|
[08254fc] | 156 |
|
---|
[22c7fe6] | 157 | <para><parameter>--localstatedir=/srv/mysql</parameter>: This switch
|
---|
| 158 | forces <application>MySQL</application> to use
|
---|
| 159 | <filename class='directory'>/srv/mysql</filename> for database files and
|
---|
| 160 | other variable data.</para>
|
---|
[4b93ac2] | 161 |
|
---|
[22c7fe6] | 162 | <para><parameter>--enable-thread-safe-client</parameter>: This
|
---|
| 163 | switch compiles a thread-safe <application>MySQL</application> client
|
---|
| 164 | library.</para>
|
---|
[4b93ac2] | 165 |
|
---|
[22c7fe6] | 166 | <para><parameter>--enable-assembler</parameter>: This switch allows using
|
---|
| 167 | assembler versions of some string functions.</para>
|
---|
[4b93ac2] | 168 |
|
---|
[22c7fe6] | 169 | <para><parameter>--enable-local-infile</parameter>: This switch enables
|
---|
| 170 | the <quote>LOAD DATA INFILE</quote> SQL statement.</para>
|
---|
[4b93ac2] | 171 |
|
---|
[22c7fe6] | 172 | <para><parameter>--with-unix-socket-path=/var/run/mysql</parameter>:
|
---|
[db9754e] | 173 | This switch puts the unix-domain socket into the
|
---|
| 174 | <filename class="directory">/var/run/mysql</filename> directory instead of
|
---|
| 175 | the default <filename class="directory">/tmp</filename>.</para>
|
---|
[867e611] | 176 |
|
---|
[22c7fe6] | 177 | <para><parameter>--without-readline</parameter>: This switch forces the
|
---|
| 178 | build to use the system copy of <application>readline</application> instead
|
---|
| 179 | of the bundled copy.</para>
|
---|
[867e611] | 180 |
|
---|
[9f12e36] | 181 | <para><parameter>--with-extra-charsets=all</parameter>: This switch enables
|
---|
[9b603d4] | 182 | international character sets within the suite.</para>
|
---|
| 183 |
|
---|
[9c98f0e] | 184 | <para><parameter>--with-plugins=innobase,myisam</parameter>: This switch enables
|
---|
| 185 | two useful table types. Check <command>./configure --help</command> for
|
---|
| 186 | other table types.</para>
|
---|
| 187 |
|
---|
[6a07e73] | 188 | <para><parameter>--with-ssl</parameter>: This switch enables encrypted
|
---|
| 189 | communication between client and server.</para>
|
---|
| 190 |
|
---|
[9c98f0e] | 191 | <para><command>make benchdir_root=...</command>: This installs the benchmark
|
---|
| 192 | and test suites in a non-system location.</para>
|
---|
[4b93ac2] | 193 |
|
---|
[9dfd852b] | 194 | <para><command>ln -v -sf mysql/libmysqlclient{,_r}.so* .</command>: This
|
---|
[22c7fe6] | 195 | command makes the <application>MySQL</application> shared libraries
|
---|
| 196 | available to other packages at run-time.</para>
|
---|
[08254fc] | 197 |
|
---|
[22c7fe6] | 198 | <para><option>--with-openssl</option>: This switch adds OpenSSL support
|
---|
| 199 | to <application>MySQL</application>.</para>
|
---|
[867e611] | 200 |
|
---|
[9dfd852b] | 201 | <para><option>--with-libwrap</option>: This switch adds tcpwrappers
|
---|
[9b603d4] | 202 | support to <application>MySQL</application>.</para>
|
---|
[9dfd852b] | 203 |
|
---|
[22c7fe6] | 204 | </sect2>
|
---|
[08254fc] | 205 |
|
---|
[22c7fe6] | 206 | <sect2 role="configuration">
|
---|
| 207 | <title>Configuring MySQL</title>
|
---|
[08254fc] | 208 |
|
---|
[22c7fe6] | 209 | <sect3 id="mysql-config">
|
---|
| 210 | <title>Config Files</title>
|
---|
[08254fc] | 211 |
|
---|
[22c7fe6] | 212 | <para><filename>/etc/my.cnf</filename> and
|
---|
| 213 | <filename>~/.my.cnf</filename></para>
|
---|
[08254fc] | 214 |
|
---|
[22c7fe6] | 215 | <indexterm zone="mysql mysql-config">
|
---|
| 216 | <primary sortas="e-AA.my.cnf">~/.my.cnf</primary>
|
---|
| 217 | </indexterm>
|
---|
[08254fc] | 218 |
|
---|
[22c7fe6] | 219 | <indexterm zone="mysql mysql-config">
|
---|
| 220 | <primary sortas="e-etc-my.cnf">/etc/my.cnf</primary>
|
---|
| 221 | </indexterm>
|
---|
[08254fc] | 222 |
|
---|
[22c7fe6] | 223 | </sect3>
|
---|
[08254fc] | 224 |
|
---|
[22c7fe6] | 225 | <sect3>
|
---|
| 226 | <title>Configuration Information</title>
|
---|
[08254fc] | 227 |
|
---|
[22c7fe6] | 228 | <para>There are several default configuration files available in
|
---|
| 229 | <filename class="directory">/usr/share/mysql</filename> which you can
|
---|
| 230 | use. Create <filename>/etc/my.cnf</filename> using the following command
|
---|
| 231 | as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[08254fc] | 232 |
|
---|
[9c98f0e] | 233 | <screen role="root"><userinput>install -v -m644 /usr/share/mysql/my-medium.cnf /etc/my.cnf
|
---|
| 234 | sed -i -e s/^skip-federated/#skip-federated/ /etc/my.cnf</userinput></screen>
|
---|
| 235 |
|
---|
| 236 | <para>The change to <filename>/etc/my.cnf</filename> can be omitted if the
|
---|
| 237 | option <option>--with-plugins=federated</option> is used.</para>
|
---|
[08254fc] | 238 |
|
---|
[22c7fe6] | 239 | <para>You can now install a database and change the ownership to the
|
---|
| 240 | unprivileged user and group (perform as the <systemitem
|
---|
| 241 | class="username">root</systemitem> user):</para>
|
---|
[08254fc] | 242 |
|
---|
[22c7fe6] | 243 | <screen role="root"><userinput>mysql_install_db --user=mysql &&
|
---|
| 244 | chgrp -v mysql /srv/mysql{,/test,/mysql}</userinput></screen>
|
---|
[08254fc] | 245 |
|
---|
[22c7fe6] | 246 | <para>Further configuration requires that the
|
---|
[9dfd852b] | 247 | <application>MySQL</application> server is running. Start
|
---|
[22c7fe6] | 248 | the server using the following commands as the <systemitem
|
---|
| 249 | class="username">root</systemitem> user:</para>
|
---|
[08254fc] | 250 |
|
---|
[515209b3] | 251 | <screen role="root"><userinput>install -v -m755 -o mysql -g mysql -d /var/run/mysql &&
|
---|
[22c7fe6] | 252 | mysqld_safe --user=mysql 2>&1 >/dev/null &</userinput></screen>
|
---|
[08254fc] | 253 |
|
---|
[9dfd852b] | 254 | <para>A default installation does not set up a password for the
|
---|
[22c7fe6] | 255 | administrator, so use the following command as the <systemitem
|
---|
| 256 | class="username">root</systemitem> user to set one. Replace
|
---|
[3cb0c57] | 257 | <replaceable><new-password></replaceable> with your own.</para>
|
---|
[08254fc] | 258 |
|
---|
[3cb0c57] | 259 | <screen role="root"><userinput>mysqladmin -u root password <replaceable><new-password></replaceable></userinput></screen>
|
---|
[08254fc] | 260 |
|
---|
[22c7fe6] | 261 | <para>Configuration of the server is now finished. Shut the server
|
---|
| 262 | down using the following command as the <systemitem
|
---|
| 263 | class="username">root</systemitem> user:</para>
|
---|
[4b93ac2] | 264 |
|
---|
[22c7fe6] | 265 | <screen role="root"><userinput>mysqladmin -p shutdown</userinput></screen>
|
---|
[08254fc] | 266 |
|
---|
[22c7fe6] | 267 | </sect3>
|
---|
[08254fc] | 268 |
|
---|
[22c7fe6] | 269 | <sect3 id="mysql-init">
|
---|
| 270 | <title>Boot Script</title>
|
---|
[08254fc] | 271 |
|
---|
[22c7fe6] | 272 | <para>Install the <filename>/etc/rc.d/init.d/mysql</filename> init script
|
---|
[5254d12] | 273 | included in the <xref linkend="bootscripts"/> package as
|
---|
[22c7fe6] | 274 | the <systemitem class="username">root</systemitem> user to start the
|
---|
| 275 | <application>MySQL</application> server during system boot-up.</para>
|
---|
[08254fc] | 276 |
|
---|
[22c7fe6] | 277 | <indexterm zone="mysql mysql-init">
|
---|
| 278 | <primary sortas="f-mysql">mysql</primary>
|
---|
| 279 | </indexterm>
|
---|
[20f5e71a] | 280 |
|
---|
[22c7fe6] | 281 | <screen role="root"><userinput>make install-mysql</userinput></screen>
|
---|
[20f5e71a] | 282 |
|
---|
[22c7fe6] | 283 | </sect3>
|
---|
[08254fc] | 284 |
|
---|
[22c7fe6] | 285 | </sect2>
|
---|
[08254fc] | 286 |
|
---|
[22c7fe6] | 287 | <sect2 role="content">
|
---|
| 288 | <title>Contents</title>
|
---|
| 289 |
|
---|
| 290 | <segmentedlist>
|
---|
| 291 | <segtitle>Installed Programs</segtitle>
|
---|
| 292 | <segtitle>Installed Libraries</segtitle>
|
---|
| 293 | <segtitle>Installed Directories</segtitle>
|
---|
| 294 |
|
---|
| 295 | <seglistitem>
|
---|
[9dfd852b] | 296 | <seg>comp_err, innochecksum, msql2mysql, my_print_defaults,
|
---|
| 297 | myisam_ftdump, myisamchk, myisamlog, myisampack, mysql,
|
---|
| 298 | mysql_client_test, mysql_config, mysql_convert_table_format,
|
---|
| 299 | mysql_create_system_tables, mysql_explain_log, mysql_find_rows,
|
---|
| 300 | mysql_fix_extensions, mysql_fix_privilege_tables, mysql_install_db,
|
---|
| 301 | mysql_secure_installation, mysql_setpermission, mysql_tableinfo,
|
---|
| 302 | mysql_tzinfo_to_sql, mysql_waitpid, mysql_zap, mysqlaccess, mysqladmin,
|
---|
| 303 | mysqlbinlog, mysqlbug, mysqlcheck, mysqld, mysqld_multi, mysqld_safe,
|
---|
| 304 | mysqldump, mysqldumpslow, mysqlhotcopy, mysqlimport, mysqlmanager,
|
---|
| 305 | mysqlshow, mysqltest, mysqltestmanager, mysqltestmanager-pwgen,
|
---|
| 306 | mysqltestmanagerc, perror, replace, resolve_stack_dump, and
|
---|
| 307 | resolveip</seg>
|
---|
| 308 | <seg>libdbug.a, libheap.a, libmyisam.a, libmyisammrg.a,
|
---|
[3cb0c57] | 309 | libmysqlclient.{so,a}, libmysqlclient_r.{so,a}, libmystrings.a,
|
---|
[9dfd852b] | 310 | libmysys.a, and libvio.a</seg>
|
---|
[22c7fe6] | 311 | <seg>/srv/mysql, /usr/include/mysql, /usr/lib/mysql, /usr/share/mysql, and
|
---|
| 312 | /var/run/mysql</seg>
|
---|
| 313 | </seglistitem>
|
---|
| 314 | </segmentedlist>
|
---|
| 315 |
|
---|
| 316 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 317 |
|
---|
| 318 | <para>Descriptions of all the programs and libraries would be several
|
---|
[9dfd852b] | 319 | pages long. Instead, consult the <filename>mysql.info</filename>
|
---|
| 320 | documentation or the on-line reference manual at <ulink
|
---|
| 321 | url="http://dev.mysql.com/doc/refman/5.0/en/index.html"/>.</para>
|
---|
[22c7fe6] | 322 |
|
---|
[9dfd852b] | 323 | <para>The <application>Perl</application> DBI modules must be installed
|
---|
| 324 | for some of the <application>MySQL</application> support programs to
|
---|
| 325 | function properly.</para>
|
---|
[22c7fe6] | 326 |
|
---|
| 327 | </sect2>
|
---|
[f45b1953] | 328 |
|
---|
| 329 | </sect1>
|
---|