SunQuest
 
       MySQL
  Home arrow MySQL arrow Page 5 - MySQL Installation and Configuration
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MYSQL

MySQL Installation and Configuration
By: McGraw-Hill/Osborne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 110
    2004-04-28

    Table of Contents:
  • MySQL Installation and Configuration
  • Choosing Between Binary and Source Distributions
  • Installing and Configuring MySQL (Linux/Unix)
  • Installing MySQL from a Binary Tarball Distribution (Linux/Unix)
  • Installing MySQL from a Source Distribution (Linux/Unix)
  • Installing and Configuring MySQL on Windows
  • Installing MySQL from a Source Distribution (Windows)
  • Testing MySQL
  • Post-Installation Steps

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    MySQL Installation and Configuration - Installing MySQL from a Source Distribution (Linux/Unix)


    (Page 5 of 9 )

    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
    [root@host]# 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 5.

    MySQL Installation and Configuration
    FIGURE 5  The directory structure obtained on unpackaging
    of a MySQL source tarball 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 configure 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 6 has a sample) as configure configures and sets up the variables needed for the compilation process.

    MySQL Installation and Configuration
    FIGURE 6  Configuring the MySQL source tree on Linux

    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 7).

    MySQL Installation and Configuration
    FIGURE 7  Building MySQL on Linux

    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 cache
    •  --without-debug  Disables debugging routines
    •  --with-openssl  Includes OpenSSL support

    Use the configure --help command to get a complete list of options.

    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 8 demonstrates what your screen should look like during the installation process.

    MySQL Installation and Configuration
    FIGURE 8  Installing compiled 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 daemon:

    [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.

    Version Control

    In case you’re wondering, all the binaries used when developing this book have been built on Linux using the following software versions:

    • mysqld 4.0.15-standard
    • mysqld-4.1-alpha
    • rpm 4.1
    • gcc 3.2
    • tar 1.13.25
    • gunzip 1.3.3
    • unzip 5.50
    • make 3.79.1
    • autoconf 2.53
    • automake 1.6.3

    Remember: this is chapter three of MySQL: The Complete Reference, by Vikram Vaswani (McGraw-Hill/Osborne, ISBN 0-07-222477-0, 2004). Vikram is the founder of Melonfire, and has had numerous articles featured on Dev Shed. 
    Buy this book now.

    More MySQL Articles
    More By McGraw-Hill/Osborne


     

       

    MYSQL ARTICLES

    - MySQL Table Prefix Changer Tool in PHP
    - Using the SIGNAL Statement for Error Handling
    - Error Handling Examples
    - Error Handling
    - Completing a Search Engine with MySQL and PH...
    - Paginating Result Sets for a Search Engine B...
    - Building a Search Engine with MySQL and PHP 5
    - Using Boolean Operators for Full Text and Bo...
    - PHP, MySQL and the PEAR Database
    - Working with PHP and MySQL
    - Getting PHP to Talk to MySQL
    - Creating an RSS Reader: the Reader
    - MySQL Security Overview
    - Creating the Admin Script for a PHP/MySQL Bl...
    - Creating the Blog Script for a PHP/MySQL Blo...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway