Transcription

Learning MySQL

Learning MySQLSeyed M.M. “Saied” Tahaghoghi and Hugh E. WilliamsBeijing Cambridge Farnham Köln Sebastopol Taipei Tokyo

Learning MySQLby Seyed M.M. “Saied” Tahaghoghi and Hugh E. WilliamsCopyright 2007 O’Reilly Media. All rights reserved.Printed in the United States of America.Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.O’Reilly books may be purchased for educational, business, or sales promotional use. Online editionsare also available for most titles (http://safari.oreilly.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected]: Andy OramProduction Editor: Sanders KleinfeldCopyeditor: Sanders KleinfeldProofreader: Colleen GormanIndexer: Julie HawksCover Designer: Karen MontgomeryInterior Designer: David FutatoIllustrators: Robert Romano and Jessamyn ReadPrinting History:November 2006:First Edition.Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks ofO’Reilly Media, Inc. Learning MySQL, the image of blue spotted crows and related trade dress aretrademarks of O’Reilly Media, Inc.Many of the designations uses by manufacturers and sellers to distinguish their products are claimed astrademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of atrademark claim, the designations have been printed in caps or initial capsWhile every precaution has been taken in the preparation of this book, the publisher and authors assumeno responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.TMThis book uses RepKover , a durable and flexible lay-flat binding.ISBN: 978-0-596-00864-2[M]1259603998[01/09]

Table of ContentsPreface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiPart I. Introduction1.Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Why Is MySQL so Popular?Elements of MySQL and Its EnvironmentMySQL Software Covered in This BookThe Book’s Web Site2.Installing MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Installation Choices and PlatformsUsing the Command-Line InterfaceUsing a Text EditorFollowing the Instructions in This BookDownloading and Verifying Files from the MySQL AB Web SiteInstalling Under LinuxInstalling Under WindowsInstalling Under Mac OS XUsing a MySQL Installation Provided by an ISPUpgrading an Existing MySQL ServerConfiguring Access to the MySQL ServerWhat If Things Don’t Work?The Contents of the MySQL DirectoryConfiguring and Controlling the Apache Web ServerSetting up 58183889394Using the MySQL Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95Starting the Monitor95v

Style, Case, and SemicolonsThe Monitor HelpRunning the Monitor in Batch ModeLoading the Sample DatabasesMySQL Monitor Program OptionsGraphical ClientsExercises9798101102102104105Part II. Using MySQL4.Modeling and Designing Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109How Not to Develop a DatabaseThe Database Design ProcessThe Entity Relationship ModelEntity Relationship Modeling ExamplesUsing the Entity Relationship ModelUsing Tools for Database DesignResourcesExercises5.Basic SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135Using the Music DatabaseThe SELECT Statement and Basic Querying TechniquesThe INSERT StatementThe DELETE StatementThe UPDATE StatementExploring Databases and Tables with SHOW and mysqlshowExercises6.135139162168171173176Working with Database Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179Creating and Using DatabasesCreating TablesThe Sample Music DatabaseAltering StructuresDeleting 1212214220221Advanced Querying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223AliasesAggregating DataAdvanced JoinsNested Queriesvi Table of Contents223228237250

User VariablesTransactions and LockingTable TypesExercises8.Doing More with MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277Inserting Data Using QueriesLoading Data from Comma-Delimited FilesWriting Data into Comma-Delimited FilesCreating Tables with QueriesUpdates and Deletes with Multiple TablesReplacing DataThe EXPLAIN 294295Managing Users and Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297Understanding Users and PrivilegesCreating and Using New UsersPrivilegesThe GRANT OPTION PrivilegeHow Privileges InteractUsers and HostsChecking PrivilegesRevoking PrivilegesRemoving UsersUnderstanding and Changing PasswordsThe Default UsersDevising a User Security PolicyManaging Privileges with SQLPrivileges and PerformanceResetting Forgotten MySQL 8333339346347349Part III. Advanced Topics10. Backups and Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353Dumping a Database as SQL StatementsLoading Data from an SQL Dump FilemysqlhotcopyScheduling BackupsThe Binary LogChecking and Repairing Corrupted Tables353360361361365366Table of Contents viiV413HAV

Re-Creating Damaged Grant TablesResourcesExercises36936936911. Using an Options File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371Configuring Options for the MySQL MonitorStructure of the Options FileScope of OptionsSearch Order for Options FilesDetermining the Options in EffectExercises37137337437537637712. Configuring and Tuning the Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379The MySQL Server DaemonServer VariablesChecking Server SettingsOther Things to ConsiderResourcesExercises379383388391392392Part IV. Web Database Applications with PHP13. Web Database Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395Building a Web Database ApplicationThe Apache Web ServerIntroducing PHPUsing a PHP-Enabled Web Hosting SiteResourcesExercises39540040241041141214. PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415Language BasicsAccessing MySQL Using PHPModularizing CodeProcessing and Using User DataThe PHP Predefined Superglobal VariablesUntainting User DataSessionsThe Reload ProblemUsing PHP for Command-Line ScriptsResourcesExercisesviii Table of Contents415427449452455456462463466471471

15. A PHP Application: The Wedding Gift Registry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473Designing and Creating the Wedding DatabaseThe Login FormPassing a Message to a ScriptLogging Users In and OutThe db.php Include FileEditing the List of GiftsLoading Sample GiftsListing Gifts for SelectionSelecting and Deselecting 507507Part V. Interacting with MySQL Using Perl16. Perl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511Writing Your First Perl ProgramScripting With PerlResourcesExercises51251353853817. Using Perl with MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539Connecting to the MySQL Server and DatabaseHandling Errors When Interacting with the DatabaseUsing Queries That Return Answer SetsUsing Queries That Don’t Return Answer SetsBinding Queries and VariablesImporting and Exporting DataHandling NULL 418. Serving Perl Pages to the Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557The Perl CGI ModuleProcessing User InputA Note on mod perlPerl SecurityResourcesExercises560562566566568568Table of Contents ix

Part VI. AppendixAppendix: The Wedding Registry Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585x Table of Contents

PrefaceDatabase management systems are the electronic filing cabinets that help individualsand organizations to manage the mass of information they process each day. With awell-designed database, information can be easily stored, updated, accessed, and collated. For example, a freight company can use a database to record data associated witheach shipment, such as the sender and recipient, origin and destination, dispatch anddelivery time, current location, and shipping fee. Some of this information needs to beupdated as the shipment progresses. The current status of a shipment can be read offthe database at any time, and data on all shipments can also be summarized into regularreports.The Web has inspired a new generation of database use. It’s now very easy to developand publish multi-user applications that don’t require any custom software to be installed on each user’s computer. Adding a database to a web application allows information to be automatically collected and used. For example, a customer can visit anonline shopping site, see what’s in stock, place an order, submit payment information,and track the order until the goods are delivered. He can also place advance orders forgoods that aren’t available, and submit reviews and participate in discussions on itemshe has purchased. If all goes well, the site’s staff doesn’t need to intervene in any ofthese actions; the less staff intervention required during normal operation, the morescalable the application is to large numbers of users. The staff are then free to do moreproductive tasks, such as monitoring sales and stock in real time, and designing specialpromotions based on product sales.Both authors of this book have always been interested in using computers as a tool tomake things faster, more efficient, and more effective. Over the past few years we’verepeatedly found that the MySQL database management system—and the PHP andPerl programming languages—provide a perfect platform for serious applications suchas managing research records and marking student assignments, and not-so-seriousones like running the office sweepstakes. On the way, we’ve learned a lot of lessonsthat we’d like to pass on; this book contains the tips that we think most readers willfind useful on a daily basis.xi

Who This Book Is forThis book is primarily for people who don’t know much about deploying and using anactual database-management system, or about developing applications that use a database. We provide a readable introduction to relational databases, the MySQL database management system, the Structured Query Language (SQL), and the PHP and Perlprogramming languages. We also cover some quite advanced material that will be ofinterest even to experienced database users. Readers with some exposure to these topicsshould be able to use this book to expand their repertoire and deepen their understanding of MySQL in particular, and database techniques in general.What’s in the BookThe book is divided into six main parts:1.2.3.4.5.6.IntroductionUsing MySQLAdvanced TopicsWeb Database Applications with PHPInteracting with MySQL using PerlAppendixLet’s look at how the individual chapters are laid out.IntroductionWe first provide some context for the book in Chapter 1, where we describe howMySQL and web database applications fit into the domain of information managementtools and technologies.In Chapter 2, we explain how you can configure the software required for this book ondifferent operating systems. This chapter provides far more detail than most booksbecause we know that it’s hard to learn MySQL if you can’t first get it up and running.Chapter 3 introduces the standard text-based interface to the MySQL server. Throughthis interface, you can control almost every aspect of the database server and the databases on it.Using MySQLBefore we dive into creating and using databases, we look at proper database design inChapter 4. You’ll learn how to determine the features that your database must have,and how the information items in your database relate to each other.xii Preface

In Chapter 5, we explore how to read data from an existing MySQL database and howto store data in it.In Chapter 6, we explain how to create a new MySQL database and how to modify anexisting one.Chapter 7 covers more advanced operations such as using nested queries and usingdifferent MySQL database engines.Chapter 8 continues the advanced operations theme; in this chapter, you’ll find a discussion of importing and exporting data, and peeking under the hood to see how theMySQL server processes a given query.In any serious application, you’ll need to prevent unauthorized data access and manipulation. In Chapter 9, we look at how MySQL authenticates users and how you canallow or disallow access to data or database operations.Advanced TopicsData stored on a computer can be lost due to hardware failure, theft, or other incidentssuch as fire or flood. If you need your database, you’ll save yourself a lot of hair-pullingby setting up regular and complete backups of your database structure and data. InChapter 10, we introduce techniques that can help you easily recover from a data lossor corrupted database.MySQL is highly configurable; in Chapter 11, we describe how you can use configuration files to modify the behavior of the MySQL server and associated programs.In Chapter 12, we introduce several ways to customize your MySQL server and yourapplication database for improved performance. Small speedups for frequently usedqueries can markedly improve the overall performance of your system.Web Database Applications with PHPIn Chapter 13, we examine how web database applications work.Chapter 14 follows with an introduction to the PHP programming language and adiscussion of how PHP can be used to access and manipulate data in a MySQL database.In Chapter 15, we walk through the design of a wedding gift registry to illustrate theprocess of developing a full-fledged web database application.Interacting with MySQL Using PerlIn Chapter 16, we present an easy-to-follow introduction to the powerful Perl programming language.We continue in Chapter 17 by using the Perl DBI module to connect to a MySQLdatabase to store and read information, and to import and export data.Preface xiii

We conclude this part in Chapter 18 by using the Perl CGI module to create dynamicweb pages that can interact with a MySQL database.AppendixThe Appendix contains all the source code for the wedding gift registry developed inChapter 15. You can download this source code, and much more, from the book’s website.Conventions Used in This BookThis book uses the following typographical conventions:ItalicIndicates nomenclature that we’ve not previously used. Also used for emphasis andto indicate files and directories.Constant WidthIndicates commands and command options, usernames, and hostnames. Also usedto show the command output, and the contents of text and program files.Constant Width BoldUsed in examples to indicate commands or other text that should be typed literallyby the user.Constant Width ItalicIndicates text that you should replace with your own values—for example, yourown name or password. When this appears as part of text that you should type in,it is shown as Constant Width Italic Bold .#, Used in some examples as the root shell prompt (#) and as the user prompt ( )under the Bourne or bash shell. Unless stated otherwise, instructions in such examples can be used with little modification from the Windows command prompt.C:\ Used in some examples as the Windows command prompt.Signifies a tip, suggestion, or general note.Indicates a warning or caution.xiv Preface

ResourcesEach chapter finishes with a list of books and web sites that contain further informationon the topics covered. The book also has a companion web site at http://www.learningmysql.com that contains links to useful resources, frequently asked questions (FAQs),and the example code and data used in this book. It’s probably a good idea to have aquick look at the web site now so that you know what’s there; it could save you a lotof searching and typing!Using Code ExamplesThis book is here to help you get your job done. In general, you may use the code inthis book in your programs and documentation. You do not need to contact us forpermission unless you’re reproducing a significant portion of the code. For example,writing a program that uses several chunks of code from this book does not requirepermission. Selling or distributing a CD-ROM of examples from O’Reilly books doesrequire permission. Answering a question by citing this book and quoting examplecode does not require permission. Incorporating a significant amount of example codefrom this book into your product’s documentation does require permission.We appreciate, but do not require, attribution. An attribution usually includes the title,author, publisher, and ISBN. For example: “Learning MySQL by Seyed M.M.Tahaghoghi and Hugh E. Williams. Copyright 2007 O’Reilly Media, Inc.,978-0-596-00864-2.”If you feel your use of code examples falls outside fair use or the permission given above,feel free to contact us at [email protected] EnabledWhen you see a Safari Enabled icon on the cover of your favorite technology book, that means the book is available online through the O’ReillyNetwork Safari Bookshelf.Safari offers a solution that’s better than e-books. It’s a virtual library that lets you easilysearch thousands of top tech books, cut and paste code samples, download chapters,and find quick answers when you need the most accurate, current information. Try itfor free at http://safari.oreilly.com. (http://safari.oreilly.com)How to Contact UsPlease address comments and questions concerning this book to the publisher:O’Reilly Media, Inc.1005 Gravenstein Highway NorthPreface xv

Sebastopol, CA 95472800-998-9938 (in the United States or Canada)707-829-0515 (international/local)707-829-0104 (fax)We have a web page for this book, where we list errata, examples, or any additionalinformation. You can access this page at:http://www.oreilly.com/catalog/learnmysqlTo comment or ask technical questions about this book, send email to:[email protected] more information about books, conferences, Resource Centers, and the O’ReillyNetwork, see the O’Reilly web site at:http://www.oreilly.comWe’ve spent a lot of effort trying to ensure that the material in this book is correct andthat the instructions and examples will work in your environment. However, there isalways room for improvement, and we’re keen to know your thoughts on how we canmake things better. Please send your thoughts by email to [email protected], oruse the online feedback form at ntsFirst of all, we thank all the people around the world who have contributed to theMySQL, PHP, and Perl projects, and related open source initiatives such as Linux.These have been an important part of our lives, and of course, this wouldn’t be muchof a book without them!Writing a technical book is an incredibly time-consuming process, and only an editoras patient and steady-handed as Andy Oram could have coaxed and cajoled us intogetting the book done and out of the door. Thanks Andy!We also thank our technical reviewers, Paul Kinzelman, Falk Scholer, and OmkharArasaratnam, for pointing out many ways in which the content could be improved, andthe team at O’Reilly for converting our material into a professionally produced book.Saied TahaghoghiI thank Hugh for inviting me to collaborate on this project (and for the countless otherways he’s made my life more interesting); Santha Sumanasekara for helping me to setup my first ever Linux box and introducing me to MySQL and PHP so many years ago;my various teachers and mentors for painstakingly showing me the way; and my friendsand colleagues for helping me maintain an appearance of sanity. Most of all, I thankall my family for their constant kindness, support, and prayers; I’m especially indebtedxvi Preface

to my wife, Somayyeh, for patiently enduring for so long my claims that, “The book’salmost done!”Hugh WilliamsI thank Selina Williams for being always patient, even-tempered, encouraging, andready to listen while I slaved away on yet another (and maybe my last?) book project.Thanks also to Lucy and Rose for letting Dad work upstairs day after day, and to Mumand Dad for the lend of the Winnebago in the paddock while I bashed out a few of themore technical chapters. But most of all, thanks Saied for agreeing to take up the reinsand finish the book after I moved to Microsoft: you’re one of the best men I know. Last,another thank you to Andy Oram; you’re a very patient guy whom I’ve learnt a lot from.Preface xvii

PART IIntroduction

CHAPTER 1IntroductionMySQL (pronounced “My Ess Cue Ell”) is more than just “the world’s most popularopen source database,” as the developers at the MySQL AB corporation (http://www.mysql.com) claim. This modest-sized database has introduced millions of everydaycomputer users and amateur researchers to the world of powerful information systems.MySQL is a relatively recent entrant into the well-established area of relational databasemanagement systems (RDBMs), a concept invented by IBM researcher Edgar FrankCodd in 1970. Despite the arrival of newer types of data repositories over the past 35years, relational databases remain the workhorses of the information world. They permit users to represent sophisticated relationships between items of data and to calculatethese relationships with the speed needed to make decisions in modern organizations.It’s impressive how you can go from design to implementation in just a few hours, andhow easily you can develop web applications to access terabytes of data and servethousands of web users per second.Whether you’re offering products on a web site, conducting a scientific survey, or simply trying to provide useful data to your classroom, bike club, or religious organization,MySQL gets you started quickly and lets you scale up your services comfortably overtime. Its ease of installation and use led media analyst Clay Shirky to credit MySQLwith driving a whole new type of information system he calls “situated software”—custom software that can be easily designed and built for niche applications.In this book, we provide detailed instructions to help you set up MySQL and relatedsoftware. We’ll teach you Structured Query Language (SQL), which is used to insert,retrieve, and manipulate data. We’ll also provide a tutorial on database design, explainhow to configure MySQL for improved security, and offer you advanced hints on getting even more out of your data. In the last five chapters, we show how to interact withthe database using the PHP and Perl programming languages, and how to allow interaction with your data over the medium most people prefer these days: the Web.3

Why Is MySQL so Popular?The MySQL development process focuses on offering a very efficient implementationof the features most people need. This means that MySQL still has fewer features thanits chief open source competitor, PostgreSQL, or the commercial database engines.Nevertheless, the skills you get from this book will serve you well on any platform.Many database management systems—even open source ones—preceded MySQL.Why has MySQL been the choice for so many beginners and small sites, and now forsome heavyweight database users in government and industry? We can suggest a fewfactors:Size and speedMySQL can run on very modest hardware and puts very little strain on systemresources; many small users serve up information to their organizations by runningMySQL on modest desktop systems. The speed with which it can retrieve information has made it a longstanding favorite of web administrators.Over the past few years, MySQL AB has addressed the need of larger sites by addingfeatures that necessarily slow down retrieval, but its modular design lets you ignorethe advanced features and maintain the suppleness and speed for which MySQLis famous.Ease of installationPartly because MySQL is small and fast, it works the way most people want straight“out of the box.” It can be installed without a lot of difficult and sophisticatedconfiguration. Now that many Linux distributions include MySQL, installationcan be almost automatic.This doesn’t mean MySQL is free of administrative tasks. In particular, we’ll covera few things you need to do at the start to tighten security. Very little configurationis shown in this book, however, which is a tribute to the database engine’s convenience and natural qualities.Attention to standardsAs we’ll explain in the “Structured Query Language” section later in this chapter,multiple standards exist in the relational database world, and it’s impossible toclaim total conformance. But learning MySQL certainly prepares you for movingto other database engines. Moving code from one database engine to another isnever trivial, but MySQL does a reasonable job of providing a standard environment, and gets better as it develops more features.Responsiveness to communityWith a few hundred employees scattered around the globe, MySQL AB is a veryflexible organization that keeps constant tabs on user needs. At its conferences,lead developers get out in front and make themselves available to everyone with agripe or a new idea. There are also local MySQL user groups in almost every majorcity. This responsiveness is helped by the fact that MySQL is open and free; any4 Chapter 1: Introduction

sufficiently skilled programmer can look at the program code to find and perhapshelp in fixing problems.MySQL actually has a dual-license approach: if you want to build your own product around it, you pay MySQL AB a license fee. If you just want to use MySQL toserve your own data, you don’t have to pay the license fee. MySQL also offerstechnical support, as do numerous other companies and consultants, some of themprobably near you.Easy interface to other softwareIt is easy to use MySQL as part of a larger software system. For example, you canwrite programs that can interact directly with a MySQL database. Most majorprogramming languages have libraries of functions for use with MySQL; these include C, PHP, Perl, Python, Ruby, and the Microsoft .NET languages. MySQL alsosupports the Open Database Connectivity (ODBC) standard, making it accessibleeven when MySQL-specific functionality isn’t available.Elements of MySQL and Its EnvironmentYou need to master several skills to run a database system. In this section, we’ll lay outwhat goes into using MySQL and how we meet those needs in this book.A MySQL installation has two components: a server that manages the data, and clients that ask the server to do things with the data, such as change entries or providereports. The client that you’ll probably use most often is the mysql “MySQL monitor”program, provided by the MySQL AB company and available in most MySQL installations. This allows you to connect to a MySQL server and run SQL queries. Othersimple clients are included in a typical installation; for example, the mysqladmin programis a client that allows you to perform various server administration tasks.In fact, any program that knows how to talk to the MySQL server is a client; a programfor a web-based shopping site or an application to generate sales graphs for a marketingteam can both be clients. In Chapter 3, you’ll learn to use the MySQL monitor clientto access the MySQL server. In Chapters 13 through 15, we’ll look at how we can usePHP to write our own custom clients that run on a web server to present a web frontendto the database for this. We’ll use the Apache web server (http://httpd.apache.org).Apache has a long history of reliable service and has been the most popular web serverin the world for over 10 years. The Apache web server—or “HTTP server”— projectis managed by the Apache Foundation (http://www.apache.org). Although the webserver and MySQL server are separate programs and can run on separate computers,it’s common to find small- to medium-scale implementations that have both runningon a single computer. In Chapters 16 through 18, we’ll explore how the Perl programming language can be used to build command-line and web interfaces to the MySQLserver.Elements of MySQL and Its Environment 5

To follow the content in this book, you will need some software; fortunately, all thesoftware we use is open source, free for noncommercial use, and easily downloadedfrom the Internet. To cover all parts of this book, you need a MySQL database server,Perl, and a web server that can talk to MySQL using the PHP and Perl programminglanguages. We’ll explore four aspects of using MySQL:MySQL serverWe explain how to create your own MySQL installation, and how to configure andadminister it.SQLThis is the core of MySQL use, and the major topic in this book. It’s introduced in“Structured Query Language.”Programming languagesSQL is not a simple or intuitive language, and it can be tedious to repeatedly perform complex operations. You can instead use a general-purpose programminglangua

Downloading and Verifying Files from the MySQL AB Web Site 22 Installing Under Linux 25 Installing Under Windows 51 Installing Under Mac OS X 61 Using a MySQL Installation Provided by an ISP 69 Upgrading an Existing MySQL Server 69 Configuring Access to the MySQL Server 74 What If Things Don’t Work? 7