1. Home
  2. Computing & Technology
  3. Perl

Beginning Perl Tutorial - Installing and Using MySQL
Creating a simple database

by Kirk Brown
for About.com

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

Explore Perl
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Perl
  4. Perl Tutorials
  5. A tutorial on using Perl to connect to a MySQL database.>

©2009 About.com, a part of The New York Times Company.

All rights reserved.