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.

Package information

MySQL dependencies

Installation of MySQL

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

groupadd mysql &&
useradd -c mysql -d /dev/null -g mysql -s /bin/false mysql

Build and install MySQL by running the following commands:

./configure --prefix=/usr --sysconfdir=/etc \
    --libexecdir=/usr/sbin --localstatedir=/var/lib/mysql \
    --enable-thread-safe-client --enable-local-infile \
    --enable-assembler --without-debug --without-bench &&
make testdir=/usr/lib/mysql/mysql-test &&
make testdir=/usr/lib/mysql/mysql-test install

Packages that depend on MySQL need the shared libraries available at run-time:

cd /usr/lib &&
ln -sf mysql/libmysqlclient{,_r}.so* .

Configuring MySQL

Config files

/etc/my.cnf, ~/.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:

cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

You can now install a database and change the ownership to the unprivileged user and group.

mysql_install_db &&
chown -R mysql:mysql /var/lib/mysql

Further configuration requires that the mysql server be running:

mysqld_safe --user=mysql 2>&1 >/dev/null &

A default installation does not setup a password for the administrator, so use the following command 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:

mysqladmin -p shutdown

Install the /etc/rc.d/init.d/mysql init script included in the blfs-bootscripts-5.1 package.

make install-mysql


The MySQL package contains comp_err, isamchk, isamlog, make_win_src_distribution, msql2mysql, my_print_defaults, myisamchk, myisamlog, myisampack, mysql, mysql_config, mysql_convert_table_format, mysql_explain_log, mysql_find_rows, mysql_fix_extensions, mysql_fix_privilege_tables, mysql_install, mysql_install_db, mysql_secure_installation, mysql_setpermission, mysql_tableinfo, mysql_waitpid, mysql_zap, mysqlacess,mysqladmin, mysqlbinlog, mysqlbug, mysqlcheck, mysqld, mysqld_multi, mysqld_safe, mysqldump, mysqldumpslow, mysqlhotcopy, mysqlimport, mysqlmanager, mysqlmanager-pwgen, mysqlmanagerc, mysqlshow, mysqltest, pack_isam, perror, replace, resolve_stack_dump, resolveip, libdbug, libheap, libmerge, libmyisam, libmyisammrg, libmysqlclient, libmystrings, libmysys, libnisam and libvio.


A package listing would be several pages long, we suggest consulting the MySQL documentation for full details, instead.

Certain MySQL support programs may require the Perl DBI modules to be installed to function properly.