mysql/DBI install1. Download and install mysql (the free version is now called "Community Server"). 2. Determine if you already have DBI and DBD::mysql installed. Type "perldoc DBI" and "perldoc DBD::mysql" at a command line. If you don't see documentation, you need to download and install these modules. In windows, you can use the "ppm" (perl package manager) tool from a command line. Just type "ppm" (this application gets installed when you install ActiveState's Perl package). Once in ppm, you can search for modules, and install modules. In *nix environments (including Mac OS X), you can use the "cpan" tool. Just type "cpan", or use this if that doesn't work: perl -MCPAN -e "shell"(be sure to run as root!) Mac OS X users: you might need to have Apple's Developer Tools installed (they come on the install CD/DVD, or see Apple's tools site). The modules to install are "DBI" and "DBD::mysql" ("install DBD::mysql", for example). 3. Once those are installed, make sure mysql is actually running on your machine (usually called "starting the mysql daemon"). In Windows, you might need to start the mysql service (this should have been installed in your Start menu). In *nix and Mac OS X, you can start it like this: sudo /usr/local/mysql/bin/mysqld_safe & Then you can connect to the database from Perl and/or the command-line interactive tool. 4. Mysql comes out-of-the-box with NO PASSWORDS on the accounts. Set up mysql user accounts and passwords. You'll do this from the mysql interactive shell.
5. You're ready to create tables and connect to your database from Perl. See my SQL examples page to get started. | ||
|
UW Extension Perl Programming Course Three, Perl, the Web, and Databases March 26 - June 04, 2007 (note no class May 28) Monday evenings 10 Sessions, 6:00 to 9:00 PM Instructor: Joel Grow (joelg at u.washington.edu) |
links: perl.com cpan perldoc online learn.perl.org perlmonks.org seattle perl users group (spug) |
|
|
Thursday, May 24, 2012 you're number: 797 | ||