Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Image

MySQL in a Nutshell 86

stoolpigeon writes "MySQL is frequently touted as the world's most widely used relational database management system. Many of the best known web applications and web sites use MySQL as their data repository. The popularity of MySQL has continued to grow while at the same time many were concerned by the lack of many features considered essential to a 'real' rdbms. Such naysayers have done little to impede the growth or development of MySQL. The first edition of MySQL in a Nutshell, published in 2005, gave users a handy reference to using MySQL. The second edition, published in 2008, covers many new features that MySQL fans proudly proclaim as an answer to all those critics clamoring for a better-rounded rdbms." Read below for the rest of JR's review.
MySQL in a Nutshell
author Russell J.T. Dyer
pages 561
publisher O'Reilly Media, Inc.
rating 9/10
reviewer JR Peck
ISBN 978-0-596-51433-4
summary A Desktop Quick Reference


O'Reilly's Nutshell books normally encompass two types of content; tutorials and command reference. MySQL in a Nutshell is true to that format. In this book though, the line between the two is not as cut and dried as in some of the other Nutshell books. The closest to pure reference is probably the documentation of MySQL functions. But there is always more than just a simple statement of function name and parameters. There are examples and when appropriate, Dyer explains function behavior beyond the inherently obvious. A good example would be when Dyer explains the output of Sleep() in the case of a user interrupting query execution with crtl-c.

The tutorials cover all of the basics but extend well into the meat of successfully administering an rdbms. The book begins with an introduction to MySQL itself, instructions on installation and a brief overview of the basics. These chapters make up the first section of the book and take up 35 pages. This means that the book is not an introduction to sql or using an rdbms. This book is first and foremost a reference for the MySQL user who has already moved past the introductory level. I don't think one needs to be an expert to use the book but there is no extended hand-holding for the novice. This is a plus in my opinion, rather than the publisher shoving in a bunch of extra material in an attempt to make the book useful to every reader regardless of their level of experience.

The second section, "SQL Statements and Functions", understandably comprises the majority of the text. This second edition breaks down the categories further, leading to an additional five chapters when compared to the first edition. This is evident with the first chapter, "Security and User Statements and Functions" a chapter that was not in the first edition. Here again the real strength is that the commands are not just documented but they are explained and illustrated with examples.

For the person already working as a MySQL DBA or aspiring to do so, there is excellent coverage beyond the basics. There is documentation on essential skills like back-up, recovery and replication. Another new chapter breaks out database table and schema commands on their own. The brief, but thorough documentation of these features makes this volume extremely useful to the DBA moving to MySQL from another rdbms. One struggle for me, coming to MySQL from Oracle has been that sometimes things are just done very differently than I expect. I don't need a lot of background, I just need to know the MySQL method and this book makes that quickly available and gets me running until I have time to dig further into the why. I would think that this book is a must on the bookshelf of any DBA responsible for the care of MySQL.

Section three further shores up this use with very thorough documentation of MySQL server and client tools. Chapter 15 covers mysqld and mysql. Chapter 16 covers command line utilities. There are roughly 30 utilities covered and I am sure that this chapter could be a real life saver for many. The book does not cover the gui tools available for managing and working with MySQL. This is a strength in my opinion. The tools are built on top of what is documented here and knowledge of the command line commands should adequately prepare the user to deal with any of the various gui tools available out there. This may be somewhat disconcerting to anyone coming from a MS SQL Server background. It's been my experience that folks who have only worked with MS SQL Server struggle when they don't have gui tools, whatever rdbms they are on. Fortunately for them there are a lot of options available to manage MySQL with a gui, they just aren't covered in this book.

The second group that could benefit the most from this book, beyond database administrators is the developer. The documentation of sql statements and functions is of course very useful. The fourth section covers APIs and connectors. It documents the c, perl and php APIs. These chapters follow the same easy flow of mix between documentation and tutorial. The beginning of the chapter covers the basics of connecting, executing statements against the database and the reference follows with the specifics of commands and accompanying examples.

Section five contains three appendices that cover data types, operators and server/environment variables. All three are concise but valuable and cover the information fully. The index does an excellent job of covering not only specific terms but subjects and makes it easy to find what the reader wants, even if they aren't sure of the specific command they are looking to read about.

The book is based on MySQL 5.0 and makes note of features that will be available in 5.1 and 6.0. This does not include master-master replication, since I mentioned that the book does cover that topic. But the section on replication will still be of use with that new feature I am sure. There were some formatting issues in my copy. I don't know if it was isolated or a part of a larger number of copies, I did not see it mentioned on the errata web page for the book. In the chapter on date and time functions, three of the sql examples have formatting errors. The last three characters of the last line of the example are repeated as a fourth line. I'm not sure how this crept in, and it is pretty easy to see that the characters are a typo as opposed to part of the statement but it did throw me for a moment when I looked at them. Anyone typing the command verbatim will get an opportunity to see what their client does with incorrect sql.

I think that this is an excellent book that will aid anyone who interacts with MySQL on a regular basis. There is no fluff, no cuteness and no attempt to do anything beyond providing quick access to key information. The book hits that sweet spot between providing too much or not enough. It does not try to be everything to everyone as I mentioned. It will not do all the lifting necessary to get someone who does not even know what an rdbms is to where they will need to be in order to make good use of this book. It does not dive deep on internals or more advanced topics. But what it covers in that wide middle, it covers very well.

You can purchase MySQL in a Nutshell from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

*

This discussion has been archived. No new comments can be posted.

MySQL in a Nutshell

Comments Filter:
  • Timely (Score:5, Funny)

    by $RANDOMLUSER ( 804576 ) on Monday December 01, 2008 @02:03PM (#25949129)
    Just in time to be out of date.
    • I think it covers pretty much everything for 5.1 which just became generally available and stuff for 6.0 which is still in alpha - so I think that it is going to be a valid resource for a while yet.

    • Re: (Score:3, Interesting)

      I've continued to find dead-tree references for various languages, DBMSs, etc. useful through several version changes. Of course any IT book is out of date before it's published, but the value of a good printed reference makes up for it relative to the up-to-the-minute nature of (good) online documentation. Both are important; neither is inherently superior to the other.

      • The last (IT) dead tree I bought that wasn't out of date was K&R (in 1979). I still buy them, though. Paper is kewl. huhhh huhh huh
    • Re: (Score:3, Insightful)

      by malikar ( 756974 )
      I do agree, but I also think that it's useful to have a desk reference occasionally. Although I'm not a SQL admin or a frequent developer, I do have to deal with MySQL once in a while. Having a thorough source like this can be useful. Also for the less expert programmer, SQL hasn't changed THAT much.
      • Re: (Score:2, Interesting)

        by reginaldo ( 1412879 )
        Any reference book that I have purchased previously has ended up collecting dust on my bookshelf. I guess they are good for reading when I am away from the computer, but the internet is better resource for programming, especially with software that is as well documented as MySQL.

        I would have a hard time believing this book is better than the Sun documentation [mysql.com].
        • Every book review (other than fiction) brings up this question, which basically boils down to "Why buy a dead-tree book?" and that really is irrelevant to whether or not the book is any good - so I ignore it in the review. I prefer to have books on hand for certain things. Some people don't.

          As to the value of the book with regards to the on-line documentation- that's a pretty subjective question too. I'd say that in the reference portions they are probably about the same - but in the tutorial typ

  • Wait, what? (Score:1, Insightful)

    by Anonymous Coward

    We've run out of new books to review, so we're reviewing one everyone who works with MySQL already knows?

    • everyone? really? I'd go for 'a lot of the people who work with MySQL' but I'd be skeptical if someone said 'the majority' and I really can't go with 'everyone'.

    • by hesiod ( 111176 )

      I work with MySQL and assumed such a book existed, but did not know if it was any good. That's why reviews exist.

  • If most of the world's web systems use MySQL in its present form, would it not make sense to halt development of the program and go into bug fix maintenance mode, since the lacking features are obviously not required?
  • by jalefkowit ( 101585 ) <jason AT jasonlefkowitz DOT com> on Monday December 01, 2008 @02:12PM (#25949279) Homepage

    Don't.

  • Why MySQL? (Score:2, Interesting)

    by Anonymous Coward

    I know this is going to get modded Troll or Flamebait, but why has MySQL grown in popularity while PostgreSQL has remained a distant #2 in the open-source RDBMS "market"? I just don't understand it. Can I get a [relatively] objective analysis of this phenomenon?

    • Re:Why MySQL? (Score:5, Insightful)

      by TheSunborn ( 68004 ) <mtilstedNO@SPAMgmail.com> on Monday December 01, 2008 @02:19PM (#25949399)

      I think a major reason is that most web developers for some reason still use windows, and PostgreSQL was very late with a stable windows version of their database.

      • Uh, what? Most "web developers" may well use windows as their local client but no one worthy of the tag is developing web apps on their local machine.

        MySQL was first to market, it's as simple as that. Postgre for years was impenetrable and is generally pedalled by the type of holier-than-thou uber-geek that puts everyone off (you only need to read the comments on here that accompany any story about MySQL or PHP to find the ones I mean). That is their target market and I'm sure they are happy to have cornere

        • Re: (Score:3, Interesting)

          Most "web developers" may well use windows as their local client but no one worthy of the tag is developing web apps on their local machine.

          Wow. Really? It's funny that later you talk about "the type of holier-than-thou uber-geek that puts everyone off", but you're pretty much as guilty of it as anyone else.

          Because, y'know, I could have sworn that the software I'm watching being written, to be used by many thousands of end users and the general public, was largely written by people using Zend Studio for Ec

          • by lwsimon ( 724555 )

            As someone whose primary job responsibility is maintaining a corporate intranet which serves just shy of 40,000 users daily, and receives 1.3m+ homepage views per month, I tell you I am currently using Windows as a desktop OS.

            Linux is simply not up to the task of being a stable, newbie-code-monkey-friendly OS for daily use. Just the thought of teaching my coworkers how to us SVN or Git gives me chills. CVS integrated into DreamWeaver allows them to deal with content updates, and Aptana Studio on my deskto

          • Or the previous job I had, where I oversaw a team that developed exclusively on Windows, and whose site we were responsible for saw eleven thousand dynamic page views on the home page alone.

            Err, that should be 11,000 dynamic page views per second...

    • Re:Why MySQL? (Score:5, Insightful)

      by Shados ( 741919 ) on Monday December 01, 2008 @02:20PM (#25949433)

      MySQL was supported by more free or near free shared hosts earlier. So it basically has an "earlier to market" advantage... Also, it has actively been targeting people newer to the database field (thus why some "enterprise-level" features were originally given low priority). So imagine someone new to databases, and they have 2 choices... one that is heavily targeting them, and one that doesn't really care...

      Then it sticks...when those "newbies" become "senior", they pass the word around. Also, originally, when PHPMyAdmin was all the rage, PostgreSQL was pretty much command line only, or at least the tools it had werent as well known... I remember my first job out of college, it was with PostgreSQL (long ago), and it was fairly scary. MySQL gives a better first impression, and its the first impression that "sells".

    • Comment removed (Score:5, Insightful)

      by account_deleted ( 4530225 ) on Monday December 01, 2008 @02:26PM (#25949527)
      Comment removed based on user account deletion
      • by Shados ( 741919 )

        1 and 5 are there on Postgres too. It doesn't get much easier to setup than "You dont need to do anything" or "next next next -> finish". The big one though from what you mentionned is #2, that was a huge issue back then.

        • Comment removed based on user account deletion
          • Re: (Score:2, Insightful)

            by Shados ( 741919 )

            No, you're no idiot. It USED to be hard to setup. I just took your post literally, and you stated it in present tense, so I thought you meant right now (especially since for your other points that only had to do with long ago, you specifically mentionned it).

            Sorry for the misunderstanding :)

      • You say "just because a product is better (postresql) does not mean ...". My response would be "Better for what?"

        I've had to develop applications for both MySQL (the AdWords DB) and PostgreSQL (backend of a Fortune 100 ecommerce system), and have found that each is good at slightly different tasks and in slightly different situations. There is a lot of overlap, yes, but both products can be very capable in their respective domains. Like everything else, there are positives and negatives about both. Sayi

    • Re:Why MySQL? (Score:4, Insightful)

      by stoolpigeon ( 454276 ) * <bittercode@gmail> on Monday December 01, 2008 @02:28PM (#25949551) Homepage Journal

      I think that early on PostgreSQL got a reputation as more difficult to install and administer. It also was considered slower in comparison to MySQL. If I remember correctly MySQL also had a native windows version well before PostgreSQL.
       
      I think that when one looks at the projects that picked up and ran with MySQL - for them it was enough. Whatever it lacks - they didn't really need. So it started to gain momentum and hasn't really slowed down. And once a project gets past that point, it starts to be used for that reason alone. Look around and see how easy it is to find a host that supports MySQL compared to PostgreSQL. A couple years ago it was even worse.
       
      Those are some of the factors I'm aware of that I think lead to the current situation. Those are pretty obvious but I think also pretty significant. A last one may be the difference in licensing. That's more complicated and less obvious but I think the commercial side of MySQL may have played into the whole thing as well.

      • If I remember correctly MySQL also had a native windows version well before PostgreSQL.

        You seem to say that like it's a good thing.

        • Just dealing with the reality of the situation my friend. I agree with your sentiment completely.

        • If I remember correctly MySQL also had a native windows version well before PostgreSQL.

          You seem to say that like it's a good thing.

          Yeah, it's never a good thing to support the global industry leading platform.

        • If I remember correctly MySQL also had a native windows version well before PostgreSQL.

          You seem to say that like it's a good thing.

          It isn't? Unlike the true geek of slashdot, my first computer was a Windows pc, since it's a family computer. Having Mysql on Windows saves me a lot of trouble.

    • I've asked people the same question, and the overwhelming response was lack of GUI tools to work easily with it. I'm personally indifferent which one I've got to work with.
    • by Samschnooks ( 1415697 ) on Monday December 01, 2008 @02:34PM (#25949681)

      I know this is going to get modded Troll or Flamebait, but why has MySQL grown in popularity while PostgreSQL has remained a distant #2 in the open-source RDBMS "market"? I just don't understand it. Can I get a [relatively] objective analysis of this phenomenon?

      Because folks have a hard time pronouncing "PostgreSQL".

      Is it, post-grease-squeel?

      or p.ah.st-gree-squeel?

      Or post-grease-S-Q-L?

      I won't use it because I'm afraid of looking stewpid when pronownsing it.

      • by alta ( 1263 )
        I always thought it would either be post-gres S-Q-L or post-grey S-Q-L
        • i'm glad that i'm not the only who actually pronounces it as "S-Q-L" instead of "sequel."

          i don't know why, but i've always thought it was weird to call MySQL "my sequel" or to say "sequel code," though i guess that's how most people in the industry pronounce it. and i've always just pronounced PostgreSQL post-greh S-Q-L, but apparently the developers called it post-gres Q-L according to Wikipedia and this mp3 clip [postgresql.org] on the official PostgreSQL site.

          now if i can just figure out how to pronounce "Bjarne Stroustr [wikipedia.org]

      • Re: (Score:3, Funny)

        by BKX ( 5066 )

        I vote for post-gray-skull

      • MySQL: <my><S><Q><L>
        PostgreSQL: <post><gress><Q><L>

        These are correct because they are how I pronounce them, and I am always right. Always.
      • Is it, post-grease-squeel?

        Does it feature either a young Olivia Newton John or Michelle Pfieffer in a tight outfit?

    • I vote for postgres simply being a stupid name. MySQL sounds simpler, and in the early days it was much less work to install. Postgres was just too much of a pain to type and it sounds like something you would call your red headed step child. Summed up, MySQL succeeded where Postgres failed miserably. Marketing.
    • Re: (Score:3, Insightful)

      by paimin ( 656338 )

      I think PostgreSQL has suffered because people don't know how the hell to pronounce the damn name [postgresql.org]. You can't recommend or adopt a piece of software if you are too embarrassed to say its name.

      Of course, the other side of that coin is Drizzle. Easy to pronounce, but WTF?

    • by Chyeld ( 713439 )

      You may wish to consider reading the article [slashdot.org] right below this one and consider it's implications with open source software projects.

    • Re: (Score:3, Insightful)

      by Unordained ( 262962 ) *

      As for Firebird, it fared better in terms of ease of setup than PostgreSQL (early on, the gap was huge!), and in terms of platform support (Windows support is not new, for example.) But its security model made it difficult to run on a shared host; you couldn't easily grant a user the right to create his own private database, which required admin privs, without granting him access to other private databases; also, the usernames were visible and unique across the whole set of databases, and you didn't really

    • For me and I looked at both (this was a few years back)

      MySQL was easy to setup - or more specifically easy to understand what you are doing when setting it up, PostgreSQL I was able to set up but was never sure if I did it right and could not find answers.

      There were a lot more books for MySQL and most all of them were way better than what I could find for PostgreSQL.

      On Line community support was friendlier for MySQL.

      Those three things gave me immediate success and gratification while learning MySQL, and for

    • You install some package, and it says "requires MySQL" and then you have MySQL installed. Later you need to do something database-y, and think "well, I already have MySQL on here..."
  • The second edition, published in 2008, covers many new features that MySQL fans proudly proclaim as an answer to all those critics clamoring for a better-rounded rdbms.

    It's not just about the fact that MySQL has those features now. It's that developers and users of it never properly understood why those features are important, and only went along with it when it was shown that you could get them while still getting high scores on artificial benchmarks.

    Now that they've at least fixed the fundamental problems, they've traded it for a bunch of new problems, like buggy releases and a questionable future with Sun.

    • Re: (Score:3, Insightful)

      by Frosty Piss ( 770223 )

      It's that developers and users of it never properly understood why those features are important

      Obviously they where not important features to *most* MySQL users. Folks, right tool for the job and all. MySQL clearly is the right tool for many jobs. Not all, but clearly many.

      • Re: (Score:3, Insightful)

        by Shados ( 741919 )

        Question: Is it really the right tool for that many job, or is it just a fallback option? What I mean is, do MySQL users actually do a benefit analysis of MySQL and its alternatives and find MySQL to be the best tool for the job, or are they using it because "its there", "its what everyone uses", "I heard about it while at school", etc?

        To avoid being accused of being a troll, let me give a personal example: I'm personally a SQL Server guy (sweet, now instead of being called a troll, I'll be called worse, ha

        • I'd say that most of it's users don't *need* to spend time tweaking and working around limitations, far and away the most common use of it would be (my guess) small websites, for which it is ridiculously simple to maintain. In these cases not having to spend time on a cost benefit analysis could probably be considered a feature of mysql.
          • by Shados ( 741919 )

            In these cases not having to spend time on a cost benefit analysis could probably be considered a feature of mysql.

            In this day and age, the only RDBMS that aren't "rediculously simple to maintain" are stuff like Oracle (and with the smaller free editions, thats debatable. And all of them could work fine for a "small website" (though some will have more functions than others, making it easier or harder to code the SQL to do even basic things.)

            So in the end, it comes down to what I said: people use it becau

            • I think you missed my point, for sufficiently small projects, the fact that it is there *makes* it the right tool for the job, the difference between "works" and "works best" is not worth the time to achieve.
      • The early versions of MySQL were basically SQL wrappers over BerkelyDB. But if you're going to do that, why not make it even lighterweight, like the route that SQLite later took? SQLite was ahead of MySQL in implementing transactions and still had comparable performance.

        MySQL was never the right tool for any job.

  • My summary (Score:1, Flamebait)

    by dkleinsc ( 563838 )

    It's full of bugs [slashdot.org].

  • More MySQL (Score:3, Funny)

    by sakonofie ( 979872 ) on Monday December 01, 2008 @02:24PM (#25949477)
    For those that didn't get the memo it is now officially "MySQL Day" here at slashdot.
    http://developers.slashdot.org/article.pl?sid=08/12/01/1627257 [slashdot.org]
    http://books.slashdot.org/article.pl?sid=08/12/01/1457236 [slashdot.org]
    From http://tech.slashdot.org/article.pl?sid=08/12/01/1555207 [slashdot.org]

    They even have a slideshow of "OSS alternatives" like Linux, Apache, MySQL, Firefox,Xen, Pentaho, OpenOffice.org, Drupal, Alfresco, SugarCRM, and Asterisk.

  • ... brought to you by Amazon and Sun. Book reviews belong in grade school not news sites.

    News for Nerds .. do you even remember that anymore?

    Give us news for nerds. When was the last time CNN, NBC, CBS, BBC, or any other site for news had a book review? The last time I did a book review was in Jr. High for The Sword of Shannara. This is nonsense. Amazon has a nice review system, why clutter up a site meant for news with reviews? Go to the book online and see the comments left there. This is paid advertiseme

    • Paid advertisement requires that some form of payment was exchanged. I do not work for Sun, slashdot, O'Reilly or Amazon. I did not receive any kind of compensation for writing the review beyond the satisfaction of doing so. So that accusation fails - there was no payment involved here.

      I can't answer for the folks who run slashdot - but I can answer for myself. I love books. I love to read them. I enjoy writing reviews too - it's a fun hobby. I started doing so because I would read book revie

    • Re: (Score:3, Interesting)

      by swordgeek ( 112599 )

      Well judging from your posting history, you seem to be an idiot with a vendetta against books.

      I remember News for Nerds. I also remember book reviews on /. before your user account # was created.

      However, if, as you claim, the reviewer was actually paid for his article, then you're absolutely right! How did you find this bit of information out, though? I'm curious to see the trail.

    • Yeah, I'm not sure if you've noticed this, but pretty much every non-television news source from the New York Times to the Onion does book reviews, including the BBC. [bbc.co.uk] So, y'know, welcome to the world.
  • At least according to them: http://www.sqlite.org/mostdeployed.html [sqlite.org]

  • SQLite (Score:5, Interesting)

    by Mr. McGibby ( 41471 ) on Monday December 01, 2008 @03:24PM (#25950609) Homepage Journal

    MySQL is frequently touted as the world's most widely used relational database management system.

    That would actually be SQLite. It's in cellphones, set top boxes, and all sorts of other embedded devices.

    • by slapout ( 93640 )

      Including the iPhone and the Firefox browser you're probably using to view this page.

  • For anyone who would like a ready-to-use MySQL server to experiment with while reading the book, I'd like to recommend TurnKey MySQL [turnkeylinux.org]. (disclaimer: I'm one of the developers)

    It's an easy-to-use, lightweight, installable live CD of the MySQL database that can run on real hardware in addition to most types of virtual machines. It features a Mac OS X-themed Web management interface and a Python configuration and installation console. It is based on Ubuntu 8.04.1 Hardy LTS, and is designed to provide users wi

  • I am not even sure if it still is..
    but when I read "MySQL is frequently touted as the world's most widely used relational database management system"..i giggled.

    If master L.Ellison reads it, he will giggle too .

  • I know the subject sounds inflammatory but I have hard numbers and a simple, yet realistic example. I would like it if someone would show me how to coax MySQL to perform as well as PostgreSQL for this simple query. It's been over two months since I posted this problem in two very [mysql.com] public forums [mysqlperformanceblog.com], with no response from the MySQL community. Would someone please stand up for MySQL and save it from looking weak here?!

Almost anything derogatory you could say about today's software design would be accurate. -- K.E. Iverson

Working...