Perl
  Home arrow Perl arrow Page 4 - Perl and DBI
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 
eWeek
 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? 
PERL

Perl and DBI
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 2
    2008-03-14

    Table of Contents:
  • Perl and DBI
  • Introduction to Relational Databases
  • The Relational of Relational Database
  • We Need an SQL Server—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

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    Perl and DBI - We Need an SQL Server—MySQL
    (Page 4 of 4 )

    Before we can show examples of SQL, we need an SQL server. There are many available to choose from, some that cost money, some that cost a lot of money, and some that are free. Given that we like free, we are going to choose one of the best, most powerful SQL servers available: MySQL.

    MySQL (www.mysql.com) is open source and available for many different operating systems. It is relatively easy to install and administer. It is also well documented (http://dev.mysql.com/doc/mysql/en/) and there are many good books available including the excellent The Definitive Guide to MySQL, Second Edition by Michael Kofler (Apress, 2003). MySQL is an excellent choice for small, medium, and large databases. And did we mention it is free?

    Installing MySQL

    If you are a Linux user, the chances are MySQL is installed already. Do a quick check of your system to see. If not, it will have to be installed.

    Installation instructions can be found at the MySQL website (http://dev.mysql.com/doc/ mysql/en/Installing.html). Since it is so well documented there, we will not repeat that information here. You can also check out The Definitive Guide to MySQL, Second Edition.

    Testing the MySQL Server

    Just to be sure all is well, let’s enter a few MySQL commands to the shell prompt to see if everything is working. The following examples assume that the MySQL rootuser (not to be confused with the Unixrootuser) has been given a password. Giving the MySQLrootuser a password is a very good idea if your server will be available over the network—you don’t want a pesky cracker logging into the server and being able to do devastating and destructive things like modifying or deleting your data. Let’s sayroot’s password is “RootDown”.3

    First, this command will show all the tables set up on the server:

    $ mysqlshow -u root -p
    Enter password: RootDown
    +------------------+
    |    Databases     |
    +------------------+
    | mysql            |
    | test             |
    +------------------+

    This command shows all the tables in the database namedmysql:

    $ mysqlshow -u root -p mysql
    Enter password: RootDown
    Database: mysql
    +--------------+
    |    Tables    |
    +--------------+
    | columns_priv |
    | db           |
    | func         |
    | host         |
    | tables_priv  |
    | user         |
    +--------------+

    If these commands worked, then all is well with our MySQL server. We can now create a database to store our musician information.

    Please check back next week for the continuation of this article.


    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.

       · This article is an excerpt from the book "Beginning Perl," published by Apress. We...
     

    Buy this book now. This article is excerpted from chapter 15 of the book Beginning Perl (Apress; ISBN: 159059391X). Check it out today at your favorite bookstore. Buy this book now.

       

    PERL ARTICLES

    - Perl: A Continuing Look at Hashes and Multid...
    - Perl: Another Round with Hashes
    - Perl Hashes
    - Perl Lists: A Final Look at List::Util
    - Perl Lists: Utilizing List::Util
    - Perl Lists: The Split() Function
    - SQL and CGI with Perl and DBI
    - Perl Lists: More Functions and Operators
    - SELECT Queries and Perl
    - Perl Lists: More on Manipulation
    - Creating a Database with Perl and DBI
    - Perl: Sailing the List(less) Seas
    - Perl and DBI
    - Perl: Concatenating Text and More
    - Perl Text: Quoting Without Quote Marks




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