1. Technology

Beginning Perl Tutorial - Installing and Using MySQL

Creating a simple database

By

Next: Connecting to the MySQL database in Perl

Learning MySQL is beyond the scope of this tutorial. If you're looking for more information, I'd suggest going through some of the tutorials from About's guide to PHP / MySQL, Angela Bradley in the Learn MySQL section. The tutorial on Understanding MySQL is a good spot for a beginner to start.

When you are able to do some basic administration tasks, let's create a database called perltest and in that database, we will create a simple table called samples and populate it with some data. Here is the SQL you'll need to create the table and fill in a few records, just connect to your MySQL database and run them.

 CREATE DATABASE perltest;
 USE perltest;
 CREATE TABLE samples (
 id int(10) unsigned NOT NULL auto_increment,
 name varchar(128) NOT NULL default '',
 phone varchar(128) NOT NULL default '',
 PRIMARY KEY (id)
 );
 INSERT INTO samples VALUES (1, 'Some Person', '555-5555');
 INSERT INTO samples VALUES (2, 'Another Person', '222-2222'); 

Next: Connecting to the MySQL database in Perl

  1. About.com
  2. Technology
  3. Perl
  4. Perl Tutorials
  5. A tutorial on using Perl to connect to a MySQL database.

©2014 About.com. All rights reserved.