MySQL
  Home arrow MySQL arrow Page 7 - 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 - Testing MySQL


    (Page 7 of 7 )

    After MySQL has been successfully installed, the base tables have been initialized, and the server has been started, you can verify that all is working as it should via some simple tests.

    Note that all these commands should be run from your UNIX or Windows command prompt. I am assuming here that you are running them from your MySQL installation directory (as per the examples in the section “Installing and Configuring MySQL,” this will be either /usr/local/mysql in UNIX or c:\program files\ mysql in Windows).

    Use the mysqladmin Utility to Obtain Server Status

    The mysqladmin utility is usually located in the bin subdirectory of your MySQL installation. You can execute it by changing to that directory and executing the following command:

      [root@host]# mysqladmin version

    You should see something resembling the output shown in Figure 3-22.


    Figure 3-22.  The output of a call to mysqladmin

    Connect to the Server Using the MySQL Client, and Execute Simple SQL Commands

    The MySQL client that ships with the MySQL distribution is named, funnily enough, mysql. Fire it up from your command prompt by switching to the bin directory of your MySQL installation and typing

      [root@host]# mysql

    You should be rewarded with a mysql> prompt. At this point, you are connected to the MySQL server and can begin executing SQL commands or queries. Here are a few examples, with their output:

    mysql> SHOW DATABASES;
    +----------
    +
    | Database |
    +----------+
    | mysql |
    | test |
    +----------+
    2 rows in set (0.13 sec)

    mysql> USE mysql;
    Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed

    mysql> SHOW TABLES;
    +-----------------+
    | Tables_in_mysql |
    +-----------------+
    | columns_priv    | 
    | db              | 
    | func            | 
    | host            | 
    | tables_priv     | 
    | user            |
    +-----------------+
    6 rows in set (0.00 sec)

    mysql> SELECT COUNT(*) FROM user;
    +----------
    +
    | count(*) |
    +----------+
    |        4 |
    +----------+
    1 row in set (0.00 sec)

    Post-Installation Steps

    Once testing is complete, you should perform two more tasks to complete your MySQL installation:

    Alter the MySQL root Password

    When MySQL is first installed, access to the database server is restricted to the MySQL administrator, aka root. By default, this user is initialized with a null password, which is generally considered a Bad Thing. You should therefore rectify this as soon as possible by setting a password for this user via the included mysqladmin utility, using the following syntax in UNIX

      [root@host]# /usr/local/mysql/bin/mysqladmin -u root
      password ' <new-password>'
      C:\>
    c:\program files\mysql\bin\mysqladmin -u root
      password ' <new-password>'

    This password change goes into effect immediately, with no requirement to restart the server or flush the privilege table.


    Note The MySQL root user is not the same as the system root user on UNIX.

    Configure MySQL to Start Automatically When the System Boots up

    On UNIX, MySQL comes with a startup/shutdown script, which is the recommended way of starting and stopping the MySQL database server. This script, named mysql.server, is available in the support-files subdirectory of your MySQL installation, and it can be invoked as follows:

    [root@host]# /usr/local/mysql/support-files/mysql.server start
    [root@host]#
    /usr/local/mysql/support-files/mysql.server stop

    To have MySQL start automatically at boot time, you simply need to copy this script to the /etc/init.d/* directory hierarchy of your system, and then you can invoke it with appropriate parameters from your system’s bootup and shutdown scripts.

    To start MySQL automatically on Windows, you can simply add a link to the mysqld server binary to your Startup group. For more information, please refer to Chapter 13.

    With a Little Help from My Friends…

    In case you have problems starting the MySQL server, you can obtain fairly detailed information on what went wrong by looking at the MySQL error log. Most often, this log can be found in the var subdirectory of your MySQL installation, and it is named hostname.err. Other common problems, such as a forgotten superuser password or incorrect path settings, can also be discovered and resolved via a close study of this error log. You can also visit the following resources for advice on how to resolve problems you may encounter during the installation process:

    • The MySQL manual http://www.mysql.com/documentation
    • The MySQL mailing lists http://lists.mysql.com
    • Google http://www.google.com
    • Google Groups http://groups.google.com

    If you’re reporting a problem or a bug, remember to use the supplied mysqlbug script to gather necessary system information and include it in your report  

    Summary

    As a popular open-source application, MySQL is available for a wide variety of platforms and architectures, in both binary and source form. This chapter explained the distinction among the different versions of MySQL, together with recommendations on the most appropriate version for your requirements; it also demonstrated the process of installing MySQL on the two most common platforms, Linux and Windows. It provided installation and configuration instructions for both binary and source distributions and also provided pointers to online resources for other platforms and for detailed troubleshooting advice and assistance.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · 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 4 hosted by Hostway