11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

www.it-ebooks.infoC H A P T E R 27• • •The Many <strong>MySQL</strong> Clients<strong>MySQL</strong> comes with quite a few utilities, or clients, each of which provides interfaces for carrying outvarious tasks pertinent to server administration. This chapter offers a general overview of the mostcommonly used clients and provides an in-depth introduction to the native mysql and mysqladminclients. Because the <strong>MySQL</strong> manual already does a fantastic job at providing a general overview of eachclient, this chapter instead focuses on those features that you’re most likely to regularly use in your dailyadministration activities.Of course, not all users are interested in managing databases from the command line; therefore, the<strong>MySQL</strong> developers and third parties have been hard at work building GUI-based management solutions.This chapter concludes with an overview of several of the most prominent GUI-based administrationapplications.Introducing the Command-Line Clients<strong>MySQL</strong> is bundled with quite a few client programs, many of which you’ll use sparingly, if ever at all.However, two in particular are so useful that I work with them on a daily basis. This section offers anextensive look at these two clients (mysql and mysqladmin) and concludes with a brief introduction toseveral others.The mysql ClientThe mysql client is a useful SQL shell, capable of managing almost every conceivable aspect of a <strong>MySQL</strong>server, including creating, modifying, and deleting tables and databases; creating and managing users;viewing and modifying the server configuration; and querying table data. Although you’ll likely beworking with <strong>MySQL</strong> via a GUI-based application or an API most of the time, this client is no<strong>net</strong>helessinvaluable for carrying out various administration tasks, particularly given its scriptable functionalitywithin the shell environment. Its general usage syntax follows:mysql [options] [database_name] [noninteractive_arguments]The client can be used in interactive or noninteractive mode, both of which are introduced in thissection. Regardless of which you use, you’ll typically need to provide connection options. The specificrequired credentials depend upon your server configuration (a matter discussed in detail in Chapter 29);however, you typically need a hostname (--host=, -h), username (--user=, -u), and password (--password=, -p). Often you’ll want to include the target database name (--database=, -D) to save theextra step of executing the USE command once you’ve entered the client. Although order is irrelevant, theconnection options are generally entered like so:505

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!