%general-entities; ]> $LastChangedBy$ $Date$ MySQL-&mysql-version; MySQL 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. &lfs71_checked; Package Information Download (HTTP): Download (FTP): Download MD5 sum: &mysql-md5sum; Download size: &mysql-size; Estimated disk space required: &mysql-buildsize; Estimated build time: &mysql-time; Additional Downloads Optional patch (required if building for Amarok): Optional patch (required if building only the client): Optional Documentation (see tip below): MySQL Dependencies Required Recommended Optional libaio User Notes: Installation of MySQL Building For security reasons, running the server as an unprivileged user and group is strongly encouraged. Issue the following (as root) to create the user and group: groupadd -g 40 mysql && useradd -c "MySQL Server" -d /dev/null -g mysql -s /bin/false -u 40 mysql If the MySQL server is not needed, it is possible to build only the client libraries of MySQL. To do this you need to apply the optional patch, use the cmake option -DWITHOUT_SERVER=ON and the client-only installation instructions below. MySQL contains an embedded server library which can be enabled with the cmake option -DWITH_EMBEDDED_SERVER=ON. By default this server is built as a statically linked library, libmysqld.a, but by applying the optional patch, a shared version of this library can be built. The shared library is needed by certain applications, such as Amarok. There are numerous options available to cmake. Check the output of the `cmake . -LH` for additional customization options. See the MySQL Documentation for a full listing of all options. If you want the shared version of the embedded server library, apply the patch: patch -Np1 -i ../mysql-&mysql-version;-embedded_library_shared-1.patch If building the client-only, apply the patch: patch -Np1 -i ../mysql-&mysql-version;-fix_client_only-1.patch Configure and build MySQL by running the following commands: mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=/usr \ -DINSTALL_DOCDIR=share/doc/mysql \ -DINSTALL_DOCREADMEDIR=share/doc/mysql \ -DINSTALL_INCLUDEDIR=include/mysql \ -DINSTALL_INFODIR=share/info \ -DINSTALL_MANDIR=share/man \ -DINSTALL_MYSQLDATADIR=/srv/mysql \ -DINSTALL_MYSQLSHAREDIR=share/mysql \ -DINSTALL_MYSQLTESTDIR=share/mysql/test \ -DINSTALL_PLUGINDIR=lib/mysql \ -DINSTALL_SBINDIR=sbin \ -DINSTALL_SCRIPTDIR=bin \ -DINSTALL_SQLBENCHDIR=share/mysql/bench \ -DINSTALL_SUPPORTFILESDIR=share/mysql/support \ -DMYSQL_DATADIR=/srv/mysql \ -DMYSQL_UNIX_ADDR=/var/run/mysql/mysql.sock \ -DSYSCONFDIR=/etc \ -DWITH_PARTITION_STORAGE_ENGINE=OFF \ -DWITH_PERFSCHEMA_STORAGE_ENGINE=OFF \ -DWITH_READLINE=system \ -DWITH_SSL=system \ .. && 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. Also, two tests will fail if ipv6 is not available in the kernel either as a module or built in. The SSL tests may fail due to expired certificates. Installation (server and client) To install the server and client, issue the following command (as the root user): SEGMENTS="Client Server IniFiles ManPages SharedLibraries" SEGMENTS="$SEGMENTS Development Documentation Info Readme" for segment in $SEGMENTS; do cmake -DCMAKE_INSTALL_COMPONENT=$segment -P cmake_install.cmake done unset SEGMENTS If you built the embedded server library add Embedded to the SEGMENTS variable above. 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 . Installation (client only) If you would like to install the client software only, issue the following (as root): SEGMENTS="Client ManPages SharedLibraries" SEGMENTS="$SEGMENTS Development Documentation Info Readme" for segment in $SEGMENTS; do cmake -DCMAKE_INSTALL_COMPONENT=$segment -P cmake_install.cmake done unset SEGMENTS Command Explanations -DWITH_<engine>_STORAGE_ENGINE=ON: The default instructions only build the innobase (InnoDB) storage engine. If other storage engines are desired use this switch to enable them. Valid choices are ARCHIVE, BLACKHOLE, EXAMPLE, FEDERATED, INNOBASE, NDBCLUSTER, PARTITION and PERFSCHEMA. -DWITHOUT_SERVER=ON: Use this switch if you don't want the server and would like to build the client only. -DWITH_EMBEDDED_SERVER=ON: Use this switch to build the embedded server library. -DWITH_SSL=system: Use this switch to build against a system version of SSL. cmake -DCMAKE_INSTALL_COMPONENT=$segment ...: This command installs the appropriate portion of the package. Different segments 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 and installs datafiles in /usr/data. Configuring MySQL Config Files /etc/my.cnf and ~/.my.cnf ~/.my.cnf /etc/my.cnf Configuration Information There are several default configuration files available in /usr/share/mysql which you can use. When creating the file, ensure binary logs are disabled unless you are doing database replication. Create /etc/my.cnf using the following commands as the root user: install -v -m644 /usr/share/mysql/support/my-medium.cnf /etc/my.cnf sed -i 's/^log-bin/#log-bin/' /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 package as the root user to start the MySQL server during system boot-up. mysql make install-mysql Contents Installed Programs Installed Libraries Installed Directories innochecksum, msql2mysql, my_print_defaults, myisam_ftdump, myisamchk, myisamlog, myisampack, mysql, mysql_client_test, mysql_config, mysql_convert_table_format, mysql_find_rows, mysql_fix_extensions, mysql_install_db, mysql_plugin, mysql_secure_installation, mysql_setpermission, mysql_tzinfo_to_sql, mysql_upgrade, mysql_waitpid, mysql_zap, mysqlaccess, mysqladmin, mysqlbinlog, mysqlbug, mysqlcheck, mysqld, mysqld_multi, mysqld_safe, mysqldump, mysqldumpslow, mysqlhotcopy, mysqlimport, mysqlshow, mysqlslap, mysqltest, perror, replace, resolve_stack_dump and resolveip libmysqlclient.{so,a}, libmysqlclient_r.{so,a}, libmysqlservices.a and several in /usr/lib/mysql /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 . The Perl DBI modules must be installed for some of the MySQL support programs to function properly.