5.2. Tutorial
Following the Swiss Army knife theory (20 percent of the functions give you 80 percent of the utility), a few SQL commands go a long way to facilitate learning MySQL/Perl/DBI.
To illustrate these, we create a simple database containing information about some (fictional) people. Eventually, we’ll show how to enter this information from a form on the Web (see Chapter 7), but for now we interface with SQL directly.
First, try to make a connection to our MySQL server as the root MySQL user:
$ mysql -u root
N
The MySQL root user is different from the Linux root user. The MySQL root user is used to administer the MySQL server only.
If you see the following output:
ERROR 2002: Can’t connect to local MySQL server through socket ´/var/lib/mysql/mysql.sock´(2) ...
Get Open Source Web Development with LAMP: Using Linux, Apache, MySQL, Perl, and PHP now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.