MySQL-5.5.17

Introduction to MySQL

MySQL is a widely used and fast SQL database server. It is a client/server implementation that consists of a server daemon and many different client programs and libraries.

There may be a more recent release available from the MySQL home page. You can check http://dev.mysql.com/ and probably use the existing BLFS instructions. Note that versions other than the one shown in the download URLs have not been tested in a BLFS environment.

This package is known to build and work properly using an LFS-7.0 platform.

Package Information

Additional Downloads

MySQL Dependencies

Required

cmake-2.8.6

Recommended

OpenSSL-1.0.0e

Optional

TCP Wrappers-7.6, libaio

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/mysql

Installation of MySQL

For security reasons, running the server as an unprivileged user and group is strongly encouraged:

groupadd -g 40 mysql &&
useradd -c "MySQL Server" -d /dev/null -g mysql -s /bin/false -u 40 mysql
[Note]

Note

There are a great many options available to cmake. Check the output of the `cmake . -LH` for additional customization options. See ithe MySQL Documentation for a full listing of all options.

Build and install MySQL by running the following commands:

cmake .                                     \
   -DSYSCONFDIR=/etc                           \
   -DMYSQL_DATADIR=/srv/mysql                  \
   -DINSTALL_MYSQLDATADIR=/srv/mysql           \
   -DCMAKE_INSTALL_PREFIX=/usr                 \
   -DINSTALL_BINDIR=bin                        \
   -DINSTALL_SBINDIR=sbin                      \
   -DINSTALL_DOCDIR=share/doc/mysql            \
   -DINSTALL_DOCREADMEDIR=share/doc/mysql      \
   -DINSTALL_INCLUDEDIR=include/mysql          \
   -DINSTALL_INFODIR=share/info                \
   -DINSTALL_LIBDIR=lib                        \
   -DINSTALL_MANDIR=share/man                  \
   -DINSTALL_MYSQLSHAREDIR=share/mysql         \
   -DINSTALL_MYSQLTESTDIR=share/mysql-test     \
   -DINSTALL_PLUGINDIR=lib/plugin              \
   -DINSTALL_SCRIPTDIR=bin                     \
   -DINSTALL_SHAREDIR=share/mysql              \
   -DINSTALL_SQLBENCHDIR=share/mysql-bench     \
   -DINSTALL_SUPPORTFILESDIR=share/mysql/support-files \
   -DWITH_ZLIB=system                          \
   -DWITH_SSL=system                           \
   -DWITH_READLINE=system                      \
   -DMYSQL_UNIX_ADDR=/var/run/mysql/mysql.sock \
   -DWITH_ARCHIVE_STORAGE_ENGINE=1             \
   -DWITH_FEDERATED_STORAGE_ENGINE=1           \
   -DWITH_BLACKHOLE_STORAGE_ENGINE=1           \
   -DMYSQL_MAINTAINER_MODE=OFF                 \
   -DWITH_DEBUG=OFF                            &&
make

To test the results, issue: make test-force 2>&1 | tee test.log. This forces the test to run to completion and logs all the test output. There will be many tests that are not run due to configuration options and developer considerations. Note that if you use TCP Wrappers and have a restrictive /etc/hosts.deny file, you will need to add an appropriate entry to the /etc/hosts.allow file for the mysqld daemon. Otherwise many of the tests will fail.

[Note]

Note

The ssl tests may fail due to expired certifictes.

Now, as the root user:

SEGMENTS="Client Server IniFiles ManPages"
SEGMENTS="$SEGMENTS Development Documentation Info Readme"

for segment in $SEGMENTS; do
   cmake -DCMAKE_INSTALL_COMPONENT=$segment -P cmake_install.cmake
done

unset SEGMENTS
[Tip]

Tip

The only documentation shipped in the source tarball are mysql.info and man pages. You can download various formats of the MySQL Reference Manual from http://dev.mysql.com/doc/.

[Note]

Note

If you only want to build and install the mysql client, use:

cmake . &&
make mysqlclient libmysql

Continue as root:

make install

Command Explanations

cmake -DCMAKE_INSTALL_COMPONENT=$segment ...: This command installs the appropriate portion of the package. Different segemnts may be added or deleted as desired. Valid segments are listed with `make list_install_components`. Note that the 'DataFiles' install segment does not honor the -DMYSQL_DATADIR or -DINSTALL_MYSQLDATADIR statements.

Configuring MySQL

Config Files

/etc/my.cnf and ~/.my.cnf

Configuration Information

There are several default configuration files available in /usr/share/mysql which you can use. Create /etc/my.cnf using the following command as the root user:

install -v -m644 /usr/share/mysql/support-files/my-medium.cnf /etc/my.cnf

You can now install a database and change the ownership to the unprivileged user and group (perform as the root user):

mysql_install_db --basedir=/usr --datadir=/srv/mysql --user=mysql &&
chgrp -v mysql /srv/mysql{,/test,/mysql}

Further configuration requires that the MySQL server is running. Start the server using the following commands as the root user:

install -v -m755 -o mysql -g mysql -d /var/run/mysql &&
mysqld_safe --user=mysql 2>&1 >/dev/null &

A default installation does not set up a password for the administrator, so use the following command as the root user to set one. Replace <new-password> with your own.

mysqladmin -u root password <new-password>

Configuration of the server is now finished. Shut the server down using the following command as the root user:

mysqladmin -p shutdown

Boot Script

Install the /etc/rc.d/init.d/mysql init script included in the blfs-bootscripts-20111226 package as the root user to start the MySQL server during system boot-up.

make install-mysql

Contents

Installed Programs: comp_err, innochecksum, msql2mysql, my_print_defaults, myisam_ftdump, myisamchk, myisamlog, myisampack, mysql, mysql_client_test, mysql_config, mysql_convert_table_format, mysql_create_system_tables, mysql_explain_log, mysql_find_rows, mysql_fix_extensions, mysql_fix_privilege_tables, mysql_install_db, mysql_secure_installation, mysql_setpermission, mysql_tableinfo, mysql_tzinfo_to_sql, mysql_waitpid, mysql_zap, mysqlaccess, mysqladmin, mysqlbinlog, mysqlbug, mysqlcheck, mysqld, mysqld_multi, mysqld_safe, mysqldump, mysqldumpslow, mysqlhotcopy, mysqlimport, mysqlmanager, mysqlshow, mysqltest, mysqltestmanager, mysqltestmanager-pwgen, mysqltestmanagerc, perror, replace, resolve_stack_dump, and resolveip
Installed Libraries: libdbug.a, libheap.a, libmyisam.a, libmyisammrg.a, libmysqlclient.{so,a}, libmysqlclient_r.{so,a}, libmystrings.a, libmysys.a, and libvio.a
Installed Directories: /srv/mysql, /usr/include/mysql, /usr/lib/mysql, /usr/share/mysql, and /var/run/mysql

Short Descriptions

Descriptions of all the programs and libraries would be several pages long. Instead, consult the mysql.info documentation or the on-line reference manual at http://dev.mysql.com/doc/refman/5.1/en/index.html.

The Perl DBI modules must be installed for some of the MySQL support programs to function properly.

Last updated on 2011-11-02 05:08:32 +0000