Administration
  Home arrow Administration arrow Page 3 - Setting Up Database Driven Websites
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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? 
ADMINISTRATION

Setting Up Database Driven Websites
By: Ying Zhang
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 12
    1999-05-20

    Table of Contents:
  • Setting Up Database Driven Websites
  • Requirements
  • Installing MySQL
  • Installing Apache
  • Installing PHP
  • Creating the Database
  • Making a PHP Script
  • Testing the Script

  • 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

    Dell PowerEdge Servers

    Setting Up Database Driven Websites - Installing MySQL
    (Page 3 of 8 )

    Okay, we actually get to do something now! Assuming you've downloaded everything into /tmp, do this to install MySQL.

    The MySQL file you downloaded will be called something like mysql-3.22.21-pc-linux-gnu-i686.tar.gz, depending on your platform.. Extract this into /usr/local, you must do this as root:


    $ cd /usr/local $ su # gzip -dc mysql-3.22.21-pc-linux-gnu.i686.tar.gz | tar -xvf

    After it extracts everything, a directory called mysql-3.22.21-pc-linux-gnu-i686 (or similar) will be created. We make a symlink to this directory and give it a friendlier name:


    # ln -s mysql-3.22.21-pc-linux-gnu-i686 mysql

    Next time there is a new version of MySQL, you can just extract the binary distribution to a new directory and change the symlink.

    Creating a MySQL User

    Now we will create a user account to run the MySQL server daemons and to own all the MySQL files. Add a new user called mysql on your system using whatever commands are available for your OS (eg. useradd). No one should be logging into this account, so disable logins by:

    • setting the account expiry to a date in the past
    • entering NP or * in the password field of /etc/passwd or /etc/shadow
    • whatever your OS recommends
    Preparing MySQL

    First let's change the ownership of MySQL directories and files to be owned by the mysql user and the root group:


    # cd /usr/local # chown -R mysql mysql-3.22.22-pc-linux-gnu-i686 mysql # chgrp -R root mysql-3.22.22-pc-linux-gnu-i686 mysql

    Now we have to run a little script that creates the initial MySQL database, do this a the mysql user. This is the only time we use this account directly:


    # su mysql $ cd mysql $ scripts/mysql_install_db $ exit

    If that didn't give you any error messages, you're well on your way.

    Make MySQL Start Automatically

    MySQL comes with a little startup script in /usr/local/mysql/support-files called mysql.server. Make sure it is executable:


    $ chmod +x /usr/local/mysql/support-files/mysql.server

    You should call this from one of your system startup scripts. As this is different for every operating system, refer to your system manual for more information on how to do this.

    Testing MySQL

    MySQL comes with a sample database called test and its internal database that keeps track of permissions and users, so let's fire it up and see if everything is working so far. First start up MySQL:


    # /usr/local/mysql/support-files/mysql.server start

    If that worked, you should be able to something like:


    Starting mysqld daemon with databases from /usr/local/mysql/var

    The MySQL programs files are located in /usr/local/mysql/bin, you may want to this to your path. Start the client by running:


    # mysql

    You should see the following:


    Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 to server version: 3.22.22 Type 'help' for help. mysql>

    Next, list the installed databases by typing show databases:


    mysql> show databases;

    You should see:


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

    If you did, then it's working!! Exit MySQL by typing exit:


    mysql> exit; Bye

    Changing the Admin Password

    The first thing to do after everything works is to change the administrator password. Do this by running mysqladmin (remember that it may not be in your path):


    # mysqladmin -u root password newpassword

    This sets the password for the user root to newpassword. You probably don't want to use that, so substitute it with something clever.

    More Administration Articles
    More By Ying Zhang


     

       

    ADMINISTRATION ARTICLES

    - Configuring Load-Balanced Clusters
    - Load-Balanced Clusters
    - UNIX Time Format Demystified
    - Making Changes in the CVS
    - Building Your First CVS Repository
    - CVS Quickstart Guide
    - Authorizing Users in Samba
    - Handling User Accounts in Samba
    - Authentication in Samba
    - Accounts, Authentication, and Authorization
    - Advanced Concepts on Dealing with Files and ...
    - Dealing with Files and Filesystems
    - More Hacks for the User Environment in BSD
    - Personalizing the User Environment in BSD
    - Customizing the User Environment in BSD

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




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