InstallGuide/MySQLInstall

Go up: WikiStart

A.4. Installing MySQL for Jabberd 2

This appendix describes how to install MySQL for Jabberd 2. MySQL is one of the database systems that can be configured to provide data storage for Jabberd 2. The advantage of using MySQL is that it is fast and robust. Additionally, there are good documentation and support for MySQL.

A.4.1. Install from Source or Binaries

Pre-compiled RPM's are available, and the MySQL maintainers recommend that RPM's be used for installing MySQL. See MySQL 5.0 Downloads for the RPM's. Read the note below, if you install from RPM's. Otherwise, skip to A.4.2. to begin installing from the source code.

I Important: Minimum MySQL Version Jabberd 2 requires MySQL version 5.0 or higher. I Important: Required MySQL RPM's Jabberd 2 requires that the following 4 RPM's be installed: Server; Client Programs; Libraries and Header files; and Dynamic Client Libraries.

A.4.2. Create MySQL User and Group

You will want to create a mysql user and group to run the MySQL server:

      su
      groupadd mysql
      useradd -g mysql mysql

I Important: Check Your User and Group Commands The above commands are intended as an example. The commands and parameters for adding a user and group may vary for your system. Consult your manuals if you have any doubt about these commands.

A.4.3. Download MySQL Installation Files

Download the file mysql-5.0.45.tar.gz from the MySQL Downloads page, where "nn.nn" is the latest version of MySQL. This download file is listed as the source tarball downloads near the bottom of the page. At the time of writing, MySQL 5.0.45 is the most current version, and is used in the examples below.

A.4.4. Extract MySQL Files

Change to the directory where you downloaded the file above and then extract the MySQL files by running the command:

      tar -zxvf mysql-5.0.45.tar.gz

A.4.5. Build MySQL

Change to the build_unix directory of the MySQL directory just created:

      cd mysql-5.0.45

Configure MySQL for your system:

      ./configure --prefix=/usr

The prefix command will install MySQL under /usr, where it will be more easily found by other applications.

Build MySQL on your system:

      make

A.4.6. Install MySQL

Switch to the super-user:

      su

Install MySQL on your system:

      make install

If you receive errors, refer to the MySQL Documentation site.

A.4.7. Set Root Password for MySQL

MySQL uses its own passwords, which are completely separate from the operating system passwords. When MySQL is installed, the root MySQL password is blank, so you should create a root MySQL password as soon as you install MySQL. Use the following command (with your own password) to create the password (as superuser):

      /usr/local/bin/mysqladmin -u root password 'new-password'   

A.4.8. Copy Preference File to /etc

The MySQL install process does not automatically install a MySQL preference file to /etc/. Instead, sample configuration files are contained in the support-files directory of the source code. Choose one that fits your requirements (large, medium or small installation), and copy it to /etc so that the preference file has the name my.cnf (as superuser):

      cd support_files
      cp my-small.cnf /etc/my.cnf

A.4.9. Set Ownership for Data Directories

Set the ownership for the MySQL data directories using the user and group created above (as superuser):

      chown -R mysql:mysql /usr/local/var/mysql/

A.4.10. Create Symlinks for Shared Libraries

Create symlinks for the MySQL shared libraries so that Jabberd 2 can locate them (as superuser):

      ln -s /usr/local/include/mysql/ /usr/include/mysql
      ln -s /usr/local/lib/mysql/ /usr/lib/mysql

A.4.11. Set MySQL to Start at Boot

Set the the MySQL daemon to start at boot as the mysql user created above. Boot scripts vary by distribution and architecture and so are beyond the scope of this guide. Consult your user documentation to set /usr/local/libexec/mysqld to start at boot time.

A.4.12. Test MySQL

Your MySQL server is ready to be tested. Start the server (as superuser):

      /usr/local/bin/mysqld_safe --user=mysql &

You should now be able to connect to the server as the MySQL root users:

      /usr/local/bin/mysql

This should provide a mysql> prompt. You can test your installation with a show databases command:

      mysql> SHOW DATABASES;

You should see output like this:

      +----------+
      | Database |
      +----------+
      | mysql    |
      | test     |
      +----------+
      2 rows in set (0.00 sec)

MySQL is now successfully installed on your system.


© 2003 Will Kamishlian and Robert Norris

http://jabberd.jabberstudio.org/2/docs/ccommons.gifThis work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.