The Visibooks Guide To MySQL Basics (2006).pdf

(9137 KB) Pobierz
The Visibooks Guide to MySQL Basics
99238050.001.png
Table of Contents
Getting Started ............................................... 1
Install MySQL on a Linux computer............................................3
Start MySQL................................................................................13
Create a new database...............................................................24
Create a table ..............................................................................29
Create a record ...........................................................................35
Run a query.................................................................................38
Administering Databases ............................. 49
Restart MySQL............................................................................50
Back up a database ....................................................................53
Delete a table ..............................................................................61
Delete a database .......................................................................63
Restore a database.....................................................................64
Working with Tables ..................................... 71
Alter tables..................................................................................72
Update records ...........................................................................75
Delete records ............................................................................79
TABLE OF CONTENTS
i
Running Queries ............................................85
Sort query results ...................................................................... 86
Add query criteria ...................................................................... 96
Securing a database ...................................105
Add a local user ....................................................................... 106
Add a remote user.................................................................... 109
Remove a user ......................................................................... 111
Restrict a user .......................................................................... 112
Web-enabling Databases.............................115
Perform a query using PERL .................................................. 116
Join two tables in PERL .......................................................... 130
Create a CGI script................................................................... 134
Write a query in a CGI script ................................................... 143
ii
TABLE OF CONTENTS
Getting Started
In this section, you’ll learn how to:
Install MySQL on a Linux computer
Start MySQL
Create a new database
Create a table
Create a record
Run a query
GETTING STARTED
1
What is MySQL?
MySQL is the world's most popular open-source database program.
MySQL is more like Microsoft SQL Server (a server-based database
program) than Access (mainly for desktop users). With MySQL
running on a server, you can easily use it for business systems or
database-driven websites.
Easy to use and configure, MySQL is also capable of industrial-
strength applications. Depending on the computer it’s installed on,
MySQL can hold several terabytes of information per table.
2
GETTING STARTED
99238050.002.png
Zgłoś jeśli naruszono regulamin