[08254fc] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[ff769b8c] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
[08254fc] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
[867e611] | 7 | <!ENTITY mysql-download-http "http://mysql.he.net/Downloads/MySQL-4.1/mysql-&mysql-version;.tar.gz">
|
---|
| 8 | <!ENTITY mysql-download-ftp "ftp://mirror.mcs.anl.gov/pub/mysql/Downloads/MySQL-4.1/mysql-&mysql-version;.tar.gz">
|
---|
[ba539b8] | 9 | <!ENTITY mysql-md5sum "56a6f5cacd97ae290e07bbe19f279af1">
|
---|
| 10 | <!ENTITY mysql-size "17 MB">
|
---|
| 11 | <!ENTITY mysql-buildsize "177 MB (additional 110 MB to run the testsuite)">
|
---|
| 12 | <!ENTITY mysql-time "3.6 SBU (additional 12 SBU to run the testsuite)">
|
---|
[08254fc] | 13 | ]>
|
---|
| 14 |
|
---|
[c30b739] | 15 | <sect1 id="mysql" xreflabel="MySQL-&mysql-version;">
|
---|
[22c7fe6] | 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><application>MySQL</application> is a widely used and fast SQL
|
---|
| 33 | database server. It is a client/server implementation that consists of a
|
---|
| 34 | server daemon and many different client programs and libraries.</para>
|
---|
| 35 |
|
---|
| 36 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 37 | <itemizedlist spacing="compact">
|
---|
| 38 | <listitem>
|
---|
| 39 | <para>Download (HTTP): <ulink url="&mysql-download-http;"/></para>
|
---|
| 40 | </listitem>
|
---|
| 41 | <listitem>
|
---|
| 42 | <para>Download (FTP): <ulink url="&mysql-download-ftp;"/></para>
|
---|
| 43 | </listitem>
|
---|
| 44 | <listitem>
|
---|
| 45 | <para>Download MD5 sum: &mysql-md5sum;</para>
|
---|
| 46 | </listitem>
|
---|
| 47 | <listitem>
|
---|
| 48 | <para>Download size: &mysql-size;</para>
|
---|
| 49 | </listitem>
|
---|
| 50 | <listitem>
|
---|
| 51 | <para>Estimated disk space required: &mysql-buildsize;</para>
|
---|
| 52 | </listitem>
|
---|
| 53 | <listitem>
|
---|
| 54 | <para>Estimated build time: &mysql-time;</para>
|
---|
| 55 | </listitem>
|
---|
| 56 | </itemizedlist>
|
---|
| 57 |
|
---|
[1e11f8e] | 58 | <bridgehead renderas="sect3">MySQL Dependencies</bridgehead>
|
---|
[22c7fe6] | 59 |
|
---|
| 60 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
| 61 | <para><xref linkend="openssl"/>,
|
---|
| 62 | <xref linkend="tcpwrappers"/>,
|
---|
| 63 | <ulink url="http://sourceforge.net/projects/libedit/">libedit</ulink>
|
---|
| 64 | (as an alternative to readline),
|
---|
| 65 | <xref linkend="ORBit"/> (detected only if <xref linkend="which"/> is
|
---|
| 66 | installed),
|
---|
| 67 | <xref linkend="doxygen"/> and
|
---|
| 68 | <xref linkend="tex"/></para>
|
---|
| 69 |
|
---|
| 70 | </sect2>
|
---|
| 71 |
|
---|
| 72 | <sect2 role="installation">
|
---|
| 73 | <title>Installation of MySQL</title>
|
---|
| 74 |
|
---|
| 75 | <para>For security reasons, running the server as an unprivileged user
|
---|
| 76 | and group is strongly encouraged:</para>
|
---|
| 77 |
|
---|
[b785ab29] | 78 | <screen role="root"><userinput>groupadd -g 40 mysql &&
|
---|
| 79 | useradd -c "MySQL Server" -d /dev/null -g mysql -s /bin/false \
|
---|
| 80 | -u 40 mysql</userinput></screen>
|
---|
[22c7fe6] | 81 |
|
---|
| 82 | <para>Build and install <application>MySQL</application> by
|
---|
| 83 | running the following commands:</para>
|
---|
| 84 |
|
---|
| 85 | <screen><userinput>CPPFLAGS="-D_GNU_SOURCE" ./configure --prefix=/usr --sysconfdir=/etc \
|
---|
[4b93ac2] | 86 | --libexecdir=/usr/sbin --localstatedir=/srv/mysql \
|
---|
| 87 | --enable-thread-safe-client --enable-assembler \
|
---|
[867e611] | 88 | --enable-local-infile --with-named-thread-libs=-lpthread \
|
---|
[d0abeb0] | 89 | --with-unix-socket-path=/var/run/mysql/mysql.sock \
|
---|
[ac109439] | 90 | --without-debug --without-bench --without-readline &&
|
---|
[22c7fe6] | 91 | make testdir=/usr/lib/mysql/mysql-test</userinput></screen>
|
---|
[20f5e71a] | 92 |
|
---|
[22c7fe6] | 93 | <para>To test the results, issue: <command>make test</command>.</para>
|
---|
[9e69cae] | 94 |
|
---|
[22c7fe6] | 95 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[20f5e71a] | 96 |
|
---|
[22c7fe6] | 97 | <screen role="root"><userinput>make testdir=/usr/lib/mysql/mysql-test install &&
|
---|
[4b93ac2] | 98 | cd /usr/lib &&
|
---|
[22c7fe6] | 99 | ln -v -sf mysql/libmysqlclient{,_r}.so* .</userinput></screen>
|
---|
[4b93ac2] | 100 |
|
---|
[36769b3] | 101 | <!-- Insert this back into the 'root' installation section if
|
---|
| 102 | there are ever docs to install again
|
---|
| 103 |
|
---|
| 104 | install -v -d -m755 /usr/share/mysql/Docs/Images &&
|
---|
| 105 | install -v -m644 Docs/manual{,_toc}.html \
|
---|
| 106 | Docs/manual.txt /usr/share/mysql/Docs &&
|
---|
| 107 | install -v -m644 Docs/Images/*.{jpg,gif} /usr/share/mysql/Docs/Images &&
|
---|
| 108 |
|
---|
| 109 | -->
|
---|
| 110 |
|
---|
[22c7fe6] | 111 | </sect2>
|
---|
[4b93ac2] | 112 |
|
---|
[22c7fe6] | 113 | <sect2 role="commands">
|
---|
| 114 | <title>Command Explanations</title>
|
---|
[08254fc] | 115 |
|
---|
[22c7fe6] | 116 | <para><parameter>--libexecdir=/usr/sbin</parameter>: This switch installs
|
---|
| 117 | the <command>mysqld</command> daemon in an appropriate location.</para>
|
---|
[08254fc] | 118 |
|
---|
[22c7fe6] | 119 | <para><parameter>--localstatedir=/srv/mysql</parameter>: This switch
|
---|
| 120 | forces <application>MySQL</application> to use
|
---|
| 121 | <filename class='directory'>/srv/mysql</filename> for database files and
|
---|
| 122 | other variable data.</para>
|
---|
[4b93ac2] | 123 |
|
---|
[22c7fe6] | 124 | <para><parameter>--enable-thread-safe-client</parameter>: This
|
---|
| 125 | switch compiles a thread-safe <application>MySQL</application> client
|
---|
| 126 | library.</para>
|
---|
[4b93ac2] | 127 |
|
---|
[22c7fe6] | 128 | <para><parameter>--enable-assembler</parameter>: This switch allows using
|
---|
| 129 | assembler versions of some string functions.</para>
|
---|
[4b93ac2] | 130 |
|
---|
[22c7fe6] | 131 | <para><parameter>--enable-local-infile</parameter>: This switch enables
|
---|
| 132 | the <quote>LOAD DATA INFILE</quote> SQL statement.</para>
|
---|
[4b93ac2] | 133 |
|
---|
[22c7fe6] | 134 | <para><parameter>CPPFLAGS="-D_GNU_SOURCE"
|
---|
| 135 | --with-named-thread-libs=-lpthread</parameter>: This environment variable
|
---|
| 136 | and configure switch enable building on NPTL systems.</para>
|
---|
[c2c2d76] | 137 |
|
---|
[22c7fe6] | 138 | <para><parameter>--with-unix-socket-path=/var/run/mysql</parameter>:
|
---|
| 139 | This switch puts the unix-domain socket into <filename
|
---|
| 140 | class="directory">/var/run/mysql</filename> directory instead of default
|
---|
| 141 | <filename class="directory">/tmp</filename>.</para>
|
---|
[867e611] | 142 |
|
---|
[22c7fe6] | 143 | <para><parameter>--without-bench</parameter>: This switch skips building
|
---|
| 144 | the benchmark suite.</para>
|
---|
[867e611] | 145 |
|
---|
[22c7fe6] | 146 | <para><parameter>--without-readline</parameter>: This switch forces the
|
---|
| 147 | build to use the system copy of <application>readline</application> instead
|
---|
| 148 | of the bundled copy.</para>
|
---|
[867e611] | 149 |
|
---|
[22c7fe6] | 150 | <para><command>make testdir=...</command>: This installs the test suite in
|
---|
| 151 | <filename class='directory'>/usr/lib/mysql/mysql-test</filename>.
|
---|
| 152 | BLFS is currently seeking a method to omit the installation
|
---|
| 153 | of the test suite altogether.</para>
|
---|
[4b93ac2] | 154 |
|
---|
[22c7fe6] | 155 | <para><command>ln -sf mysql/libmysqlclient{,_r}.so* .</command>: This
|
---|
| 156 | command makes the <application>MySQL</application> shared libraries
|
---|
| 157 | available to other packages at run-time.</para>
|
---|
[08254fc] | 158 |
|
---|
[22c7fe6] | 159 | <para><option>--with-libwrap</option>: This switch adds tcpwrappers
|
---|
| 160 | support to <application>MySQL</application>.</para>
|
---|
[867e611] | 161 |
|
---|
[22c7fe6] | 162 | <para><option>--with-openssl</option>: This switch adds OpenSSL support
|
---|
| 163 | to <application>MySQL</application>.</para>
|
---|
[867e611] | 164 |
|
---|
[22c7fe6] | 165 | </sect2>
|
---|
[08254fc] | 166 |
|
---|
[22c7fe6] | 167 | <sect2 role="configuration">
|
---|
| 168 | <title>Configuring MySQL</title>
|
---|
[08254fc] | 169 |
|
---|
[22c7fe6] | 170 | <sect3 id="mysql-config">
|
---|
| 171 | <title>Config Files</title>
|
---|
[08254fc] | 172 |
|
---|
[22c7fe6] | 173 | <para><filename>/etc/my.cnf</filename> and
|
---|
| 174 | <filename>~/.my.cnf</filename></para>
|
---|
[08254fc] | 175 |
|
---|
[22c7fe6] | 176 | <indexterm zone="mysql mysql-config">
|
---|
| 177 | <primary sortas="e-AA.my.cnf">~/.my.cnf</primary>
|
---|
| 178 | </indexterm>
|
---|
[08254fc] | 179 |
|
---|
[22c7fe6] | 180 | <indexterm zone="mysql mysql-config">
|
---|
| 181 | <primary sortas="e-etc-my.cnf">/etc/my.cnf</primary>
|
---|
| 182 | </indexterm>
|
---|
[08254fc] | 183 |
|
---|
[22c7fe6] | 184 | </sect3>
|
---|
[08254fc] | 185 |
|
---|
[22c7fe6] | 186 | <sect3>
|
---|
| 187 | <title>Configuration Information</title>
|
---|
[08254fc] | 188 |
|
---|
[22c7fe6] | 189 | <para>There are several default configuration files available in
|
---|
| 190 | <filename class="directory">/usr/share/mysql</filename> which you can
|
---|
| 191 | use. Create <filename>/etc/my.cnf</filename> using the following command
|
---|
| 192 | as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[08254fc] | 193 |
|
---|
[22c7fe6] | 194 | <screen role="root"><userinput>install -v -m644 /usr/share/mysql/my-medium.cnf /etc/my.cnf</userinput></screen>
|
---|
[08254fc] | 195 |
|
---|
[22c7fe6] | 196 | <para>You can now install a database and change the ownership to the
|
---|
| 197 | unprivileged user and group (perform as the <systemitem
|
---|
| 198 | class="username">root</systemitem> user):</para>
|
---|
[08254fc] | 199 |
|
---|
[22c7fe6] | 200 | <screen role="root"><userinput>mysql_install_db --user=mysql &&
|
---|
| 201 | chgrp -v mysql /srv/mysql{,/test,/mysql}</userinput></screen>
|
---|
[08254fc] | 202 |
|
---|
[22c7fe6] | 203 | <para>Further configuration requires that the
|
---|
| 204 | <application>MySQL</application> server be running. Start
|
---|
| 205 | the server using the following commands as the <systemitem
|
---|
| 206 | class="username">root</systemitem> user:</para>
|
---|
[08254fc] | 207 |
|
---|
[515209b3] | 208 | <screen role="root"><userinput>install -v -m755 -o mysql -g mysql -d /var/run/mysql &&
|
---|
[22c7fe6] | 209 | mysqld_safe --user=mysql 2>&1 >/dev/null &</userinput></screen>
|
---|
[08254fc] | 210 |
|
---|
[22c7fe6] | 211 | <para>A default installation does not setup a password for the
|
---|
| 212 | administrator, so use the following command as the <systemitem
|
---|
| 213 | class="username">root</systemitem> user to set one. Replace
|
---|
| 214 | <replaceable>[new-password]</replaceable> with your own.</para>
|
---|
[08254fc] | 215 |
|
---|
[22c7fe6] | 216 | <screen role="root"><userinput>mysqladmin -u root password <replaceable>[new-password]</replaceable></userinput></screen>
|
---|
[08254fc] | 217 |
|
---|
[22c7fe6] | 218 | <para>Configuration of the server is now finished. Shut the server
|
---|
| 219 | down using the following command as the <systemitem
|
---|
| 220 | class="username">root</systemitem> user:</para>
|
---|
[4b93ac2] | 221 |
|
---|
[22c7fe6] | 222 | <screen role="root"><userinput>mysqladmin -p shutdown</userinput></screen>
|
---|
[08254fc] | 223 |
|
---|
[22c7fe6] | 224 | </sect3>
|
---|
[08254fc] | 225 |
|
---|
[22c7fe6] | 226 | <sect3 id="mysql-init">
|
---|
| 227 | <title>Boot Script</title>
|
---|
[08254fc] | 228 |
|
---|
[22c7fe6] | 229 | <para>Install the <filename>/etc/rc.d/init.d/mysql</filename> init script
|
---|
| 230 | included in the <xref linkend="intro-important-bootscripts"/> package as
|
---|
| 231 | the <systemitem class="username">root</systemitem> user to start the
|
---|
| 232 | <application>MySQL</application> server during system boot-up.</para>
|
---|
[08254fc] | 233 |
|
---|
[22c7fe6] | 234 | <indexterm zone="mysql mysql-init">
|
---|
| 235 | <primary sortas="f-mysql">mysql</primary>
|
---|
| 236 | </indexterm>
|
---|
[20f5e71a] | 237 |
|
---|
[22c7fe6] | 238 | <screen role="root"><userinput>make install-mysql</userinput></screen>
|
---|
[20f5e71a] | 239 |
|
---|
[22c7fe6] | 240 | </sect3>
|
---|
[08254fc] | 241 |
|
---|
[22c7fe6] | 242 | </sect2>
|
---|
[08254fc] | 243 |
|
---|
[22c7fe6] | 244 | <sect2 role="content">
|
---|
| 245 | <title>Contents</title>
|
---|
| 246 |
|
---|
| 247 | <segmentedlist>
|
---|
| 248 | <segtitle>Installed Programs</segtitle>
|
---|
| 249 | <segtitle>Installed Libraries</segtitle>
|
---|
| 250 | <segtitle>Installed Directories</segtitle>
|
---|
| 251 |
|
---|
| 252 | <seglistitem>
|
---|
| 253 | <seg>comp_err, isamchk, isamlog, make_win_binary_distribution,
|
---|
| 254 | make_win_src_distribution, msql2mysql, my_print_defaults, myisam_ftdump,
|
---|
| 255 | myisamchk, myisamlog, myisampack, mysql, mysql_client_test, mysql_config,
|
---|
| 256 | mysql_convert_table_format, mysql_create_system_tables, mysql_explain_log,
|
---|
| 257 | mysql_find_rows, mysql_fix_extensions, mysql_fix_privilege_tables,
|
---|
| 258 | mysql_install_db, mysql_secure_installation, mysql_setpermission,
|
---|
| 259 | mysql_tableinfo, mysql_tzinfo_to_sql, mysql_waitpid, mysql_zap, mysqlaccess,
|
---|
| 260 | mysqladmin, mysqlbinlog, mysqlbug, mysqlcheck, mysqld, mysqld_multi,
|
---|
| 261 | mysqld_safe, mysqldump, mysqldumpslow, mysqlhotcopy, mysqlimport,
|
---|
| 262 | mysqlmanager, mysqlmanager-pwgen, mysqlmanagerc, mysqlshow, mysqltest,
|
---|
| 263 | pack_isam, perror, replace, resolve_stack_dump, and resolveip</seg>
|
---|
| 264 | <seg>libdbug.a, libheap.a, libmerge.a, libmyisam.a, libmyisammrg.a,
|
---|
| 265 | libmysqlclient.[so,a], libmysqlclient_r.[so,a], libmystrings.a, libmysys.a,
|
---|
| 266 | libnisam.a, and libvio.a</seg>
|
---|
| 267 | <seg>/srv/mysql, /usr/include/mysql, /usr/lib/mysql, /usr/share/mysql, and
|
---|
| 268 | /var/run/mysql</seg>
|
---|
| 269 | </seglistitem>
|
---|
| 270 | </segmentedlist>
|
---|
| 271 |
|
---|
| 272 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 273 |
|
---|
| 274 | <para>Descriptions of all the programs and libraries would be several
|
---|
| 275 | pages long. Instead, consult the <application>MySQL</application>
|
---|
| 276 | documentation for full details.</para>
|
---|
| 277 |
|
---|
| 278 | <para>Certain <application>MySQL</application> support programs may
|
---|
| 279 | require the <application>Perl</application> DBI modules to be
|
---|
| 280 | installed to function properly.</para>
|
---|
| 281 |
|
---|
| 282 | </sect2>
|
---|
[f45b1953] | 283 |
|
---|
| 284 | </sect1>
|
---|