%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. &lfs72_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 (recommended if building for Amarok): Optional Documentation (see tip below): MySQL Dependencies Required Recommended Optional libaio User Notes: Installation of MySQL 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 /srv/mysql -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 add -DWITHOUT_SERVER=ON to the cmake command 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 library is needed by certain applications, such as Amarok and we recommend use of the shared libraries. 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 to build shared version of the embedded server library, apply the following patch: patch -Np1 -i ../mysql-&mysql-version;-embedded_library_shared-1.patch Install MySQL by running the following commands: sed -i "/ADD_SUBDIRECTORY(sql\/share)/d" CMakeLists.txt && sed -i "s/ADD_SUBDIRECTORY(libmysql)/&\\nADD_SUBDIRECTORY(sql\/share)/" CMakeLists.txt && sed -i "s@data/test@\${INSTALL_MYSQLSHAREDIR}@g" sql/CMakeLists.txt && sed -i "s@data/mysql@\${INSTALL_MYSQLTESTDIR}@g" sql/CMakeLists.txt && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release \ -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/mysql \ -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. 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. Now, as the root user: make install 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 . Command Explanations sed -i ...: First two seds fix client-only builds. Last two seds set correct installation directories for some components. -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: This switch is used to tell the build system to use system version of the OpenSSL. Remove it if you didn't install OpenSSL. Configuring MySQL Config Files /etc/mysql/my.cnf and ~/.my.cnf ~/.my.cnf /etc/mysql/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/mysql/my.cnf using the following commands as the root user: install -v -Dm644 /usr/share/mysql/support/my-medium.cnf /etc/mysql/my.cnf && sed -i 's/^log-bin/#log-bin/' /etc/mysql/my.cnf && sed -i 's/^binlog/#binlog/' /etc/mysql/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 && chown -R mysql:mysql /srv/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, myisamchk, myisam_ftdump, myisamlog, myisampack, my_print_defaults, mysql, mysqlaccess, mysqlaccess.conf, mysqladmin, mysqlbinlog, mysqlbug, mysqlcheck, mysql_client_test, mysql_client_test_embedded, mysql_config, mysql_convert_table_format, mysqld, mysqld_multi, mysqld_safe, mysqldump, mysqldumpslow, mysql_embedded, mysql_find_rows, mysql_fix_extensions, mysqlhotcopy, mysqlimport, mysql_install_db, mysql_plugin, mysql_secure_installation, mysql_setpermission, mysqlshow, mysqlslap, mysqltest, mysqltest_embedded, mysql_tzinfo_to_sql, mysql_upgrade, mysql_waitpid, mysql_zap, perror, replace, resolveip and resolve_stack_dump libmysqlclient.{so,a}, libmysqlclient_r.{so,a}, libmysqld.{so,a}, libmysqlservices.a and several in /usr/lib/mysql /etc/mysql, /srv/mysql, /usr/include/mysql, /usr/lib/mysql, /usr/share/doc/mysql and /usr/share/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.