Home arrow MySQL arrow Page 4 - MySQL Configuration and Installation

Installing MySQL on UNIX from a Source Distribution - MySQL

If you ever wanted to start using the open source MySQL server application on your computer, this article is for you. It will show you how to obtain, install, configure, and test the MySQL server on your system, whether you are running UNIX or Windows. It is excerpted from My SQL The Complete Reference by Vikram Vaswani (McGraw-Hill/Osborne, 2003; ISBN: 0072224770).

  1. MySQL Configuration and Installation
  2. Installing and Configuring MySQL on UNIX
  3. Installing MySQL on UNIX from a Binary Tarball Distribution
  4. Installing MySQL on UNIX from a Source Distribution
  5. Installing and Configuring MySQL on Windows
  6. Installing MySQL on Windows from a Source Distribution
  7. Testing MySQL
By: McGraw-Hill/Osborne
Rating: starstarstarstarstar / 88
June 02, 2005

print this article



If you’re planning to install MySQL from a source distribution, you’ll need to untar the source tree and go through the traditional configure-make-make install cycle to get MySQL up and running. This is a fairly time-consuming and complex process, and it’s one that shouldn’t really be attempted by novice users; however, if you’re determined to do it, here’s how:

1. Ensure that you’re logged in as root:

   [user@host]# su - root

2. Switch to the directory containing the source tarball, and
    extract the files within it. (Note that you will need
    approximately 80 MB of free space for the source tree.)

  [root@host]# cd /tmp
tar -xzvf mysql-4.0.9-gamma.tar.gz

     Remember to replace the file name in italics with the file 
     name  of your source tarball.

3. Move into the directory containing the source code,

  [root@host]# cd mysql-4.0.9-gamma

    and take a look at the contents with ls:

  [root@host]# ls -l

You should see something like Figure 3-5.

Figure 3-5.  The directory structure obtained on unpackaging of a MySQL source tarball on Linux 

Figure 3-6.  Configuring the MySQL source tree on Linux

Take a look at the sidebar entitled “Up a Tree” for more information on what each directory contains.

4. Now, set variables for the compile process via the included 
script. (Note the use of the --prefix argument to 
    configure, which sets the default installation path for the
    compiled binaries.)

  [root@host]# ./configure --prefix=/usr/local/mysql

   You should see a few screens of output (Figure 3-6 has a
   sample) as configure configures and sets up the variables
   needed for the compilation process.

5. Now compile the program using make:

   [root@host]# make

    Watch as your screen fills up with all manner of strange
    symbols and characters  (see Figure 3-7).

   The compilation process takes a fair amount of time (refer to
   the sidebar titled “Watching the Clock” for my empirical
   observations on how long you’ll be waiting), so this is a good
   time to get yourself a cup of coffee or check your mail.

   Now that you’re all done, you can test to ensure that
   everything is working properly.

6. Run the following command:

    [root@host]# make tests

Handcrafting Your Build
You can pass configure a number of command-line options that affect the build process. Here’s a list of the more interesting ones:

• --prefix  Sets the prefix for 
            installation paths
• --without-server Disables compilation of the 
            server, and compiles only the
            MySQL client programs and libraries
• --localstatedir  Sets the location in which
            the MySQL databases will
            be stored
• --with-charset Sets a default character set
• --with-debug Turns on extended debugging
• --with-raid Enables RAID support
• --with-embedded-server Builds the libmysqld
            embedded server library
• --without-query-cache Disables the query 
• --without-debug Disables debugging routines
• --with-openssl Includes OpenSSL support
Use the configure --help command to get a complete list of options.

Figure 3-7.  Building MySQL on Linux

Watching the Clock
Compiling MySQL is a fairly time-consuming process, and you should be prepared to spend anywhere between 15 to 60 minutes on the task. The following table contains some empirical observations on the time taken to compile the program on various hardware configurations:

System Configuration

Time Taken to Compile MySQL

Pentium-II@350 MhZ, 64 MB RAM

45 minutes

Pentium-III@700MhZ, 256 MB RAM

30 minutes

AMD Athlon MP 1500+, SuSE Linux 7.3

8 minutes

AMD Opteron@2x1.6 GHz, UnitedLinux 1.0

7 minutes

Apple PowerMac G4@2x1.2 GHz, Mac OS X 10.2.4

14 minutes

Compaq AlphaServer DS20@500 MHz, SuSe Linux 7.0

17 minutes

HP 9000/800/A500-7X, HP-UX 11.11

14 minutes

IBM RS/6000, AIX 4.3.3

35 minutes

Intel Itanium2@900 MHz, Red Hat AS 2.1

14 minutes

MIPS R5000@500 MHz, SGI IRIX 6.5

2 hours 30 minutes

7. Install the MySQL binaries to their new home 
     in /usr/local/mysql:

   [root@host]# make install

    Figure 3-8 demonstrates what your screen should look like
    during the installation process.

Figure 3-8.  Installing complied MySQL binaries on Linux

8. Create the special mysql user and group with the groupadd
     and useradd commands:

  [root@host]# groupadd mysql
  [root@host]# useradd -g mysql mysql

9. Run the initialization script, mysql_install_db, which ships
    with the program, to prepare MySQL for operation:

  [root@host]# /usr/local/mysql/scripts/mysql_install_db

10. Alter the ownership of the MySQL binaries so that they are
       owned by root:

   [root@host]# chown -R root /usr/local/mysql

      Now ensure that the newly minted mysql user has read/write
      access to the MySQL data directories:

   [root@host]# chown -R mysql /usr/local/mysql/var
   [root@host]# chgrp -R mysql /usr/local/mysql

11. Start the MySQL server by manually running the mysqld

   [root@host]# /usr/local/mysql/bin/mysqld_safe –-
   user=mysql &

      MySQL should start up normally, reading the base tables
      created in /usr/local/mysql/var.

At this point, you can proceed to the section titled “Testing MySQL” to verify that everything is working as it should.

>>> More MySQL Articles          >>> More By McGraw-Hill/Osborne

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Oracle Unveils MySQL 5.6
- MySQL Vulnerabilities Threaten Databases
- MySQL Cloud Options Expand with Google Cloud...
- MySQL 5.6 Prepped to Handle Demanding Web Use
- ScaleBase Service Virtualizes MySQL Databases
- Oracle Unveils MySQL Conversion Tools
- Akiban Opens Database Software for MySQL Use...
- Oracle Fixes MySQL Bug
- MySQL Databases Vulnerable to Password Hack
- MySQL: Overview of the ALTER TABLE Statement
- MySQL: How to Use the GRANT Statement
- MySQL: Creating, Listing, and Removing Datab...
- MySQL: Create, Show, and Describe Database T...
- MySQL Data and Table Types
- McAfee Releases Audit Plugin for MySQL Users

Developer Shed Affiliates


Dev Shed Tutorial Topics: