Perl Programming Page 4 - Perl and DBI |
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 MySQLIf 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 ServerJust 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 This command shows all the tables in the database namedmysql: $ mysqlshow -u root -p mysql 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.
blog comments powered by Disqus |