SunQuest
 
       MySQL
  Home arrow MySQL arrow Page 3 - MySQL Configuration and Installation
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 Configuration and Installation
By: McGraw-Hill/Osborne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 85
    2005-06-02

    Table of Contents:
  • MySQL Configuration and Installation
  • Installing and Configuring MySQL on UNIX
  • Installing MySQL on UNIX from a Binary Tarball Distribution
  • Installing MySQL on UNIX from a Source Distribution
  • Installing and Configuring MySQL on Windows
  • Installing MySQL on Windows from a Source Distribution
  • Testing MySQL

  • 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 Configuration and Installation - Installing MySQL on UNIX from a Binary Tarball Distribution


    (Page 3 of 7 )

    In case you’re using a Linux distribution that doesn’t support RPM, you can also install MySQL using a binary tarball from the MySQL web site.

    Installing from a binary distribution essentially means that you need to perform the installation steps manually rather than letting RPM automatically take care of it for you. Here’s how you go about doing it:

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

        [user@host]# su - root

    2. Extract the content of the tarball to an appropriate directory 
        on your system—I’ll assume this location is /usr/local/.
        Remember to replace the file name in italics with the file name
        of your tarball.

       [root@host]# cd /usr/local
       [root@host]# tar -xzvf
       mysql-standard-4.0.9-gamma-pc-linux-i686.tar.gz

      The MySQL files should get extracted into a directory named 
      according to the format mysql-version-os-architecturefor
      example, mysql-standard-4.0.9-gamma-pc-linux-i686.

    3. Now you’ll notice that the directory created in the previous
        step has a somewhat long and cumbersome directory name—
        something like mysql-standard-4.0.9-gamma-pc-linux-i686.
        For ease of use, create a soft link to this directory named
        mysql in the same location.

      [root@host]# ln -s mysql-standard-4.0.9-gamma-pc-linux-i686 mysql

    4. Change into this directory, and take a look at how the files are
        arranged. You should see something like Figure 3-3. (Take a
        look at the sidebar entitled “Up a Tree” for more information 
        on what each directory contains.) 



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

    Up a Tree
    If you have the time (and the inclination), you might find it instructive to explore
    the MySQL directory structure to help you better understand where the important files are located.


    For a binary distribution, the directory structure for a typical MySQL installation looks like this:


    <mysql-install-root>
    |-- bin          [client and server binaries]
    |-- data         [databases and error log]
    |-- include      [header files]
    |-- lib          [compiled libraries]
    |-- man          [manual pages]
    |-- mysql-test   [test suite]
    |-- share        [error messages in different
                      languages]
    |-- scripts      [startup, shutdown and 
                      initialization scripts]
    |-- sql-bench    [queries and data files for
                      benchmark tests]
    |-- support-files[sample configuration files]
    |-- tests        [test cases]


    For a source distribution, the directory structure for a typical MySQL installation looks like this:


    <mysql-install-root>
    |-- bin           [client binaries]
    |-- libexec       [server binaries]
    |-- var           [databases and error log]
    |-- lib           [compiled libraries]
    |-- include       [header files]
    |-- info          [info pages]
    |-- man           [manual pages]
    |-- mysql-test    [test suite]
    |-- share         [error messages in 
                       different languages]
    |-- sql-bench     [queries and data files 
                       for benchmark tests]


    Take a look at the documentation that ships with the MySQL distribution for a more detailed discussion of this directory structure.

    5. The MySQL database server can run as either the system root 
        user or any other user on the system. From the security point
        of view, it’s considered a bad idea to run the MySQL database
        server as root ; hence, it becomes necessary for you to create
        a special mysql user and group for this purpose.

        You can accomplish this using the groupadd and useradd 
        commands:

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

    6. Run the initialization script, mysql_install_db, that ships with
         the program:

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

         Figure 3-4 demonstrates what you should see when you do
         this.:

        As you can see from the output in the figure, this initialization
        script prepares and installs the various MySQL base tables and
        also sets up default access permissions for MySQL.

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

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

    8. 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/data  
      [root@host]# chgrp -R mysql /usr/local/mysql

    9. 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/data.


    Figure 3-4.  The output of running the MySQL initialization script

    Once installation has been successfully completed, you can skip to the section titled “Testing MySQL,” later in this chapter, to verify that your server is functioning properly.

    More MySQL Articles
    More By McGraw-Hill/Osborne


       · Hi,This article is not expalining the way such as installing the mysql by adding...
       · you left out the part about how to start mysqld. (reboot? I dunno). Installed the...
       · Given the word "Configuration" I expected to find a lot more on the subject of...
       · I agree 100% this article was a total phony. This was nothing more than a...
     

    Buy this book now. This article is taken from chapter three of the book My SQL The Complete Reference by Vikram Vaswani (McGraw-Hill/Osborne, 2003; ISBN 0072224770). Check it out at your favorite bookstore. Buy this book now.

       

    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 2 hosted by Hostway