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.

CHAPTER 27 • THE MANY MYSQL CLIENTSwww.it-ebooks.info| Create_priv | enum('N','Y') | NO | | N | || Drop_priv | enum('N','Y') | NO | | N | || Grant_priv | enum('N','Y') | NO | | N | || References_priv | enum('N','Y') | NO | | N | || Index_priv | enum('N','Y') | NO | | N | || Alter_priv | enum('N','Y') | NO | | N | || Create_tmp_table_priv | enum('N','Y') | NO | | N | || Lock_tables_priv | enum('N','Y') | NO | | N | || Create_view_priv | enum('N','Y') | NO | | N | || Show_view_priv | enum('N','Y') | NO | | N | || Create_routine_priv | enum('N','Y') | NO | | N | || Alter_routine_priv | enum('N','Y') | NO | | N | || Execute_priv | enum('N','Y') | NO | | N | || Trigger_priv | enum('N','Y') | NO | | N | |+--------------------------+---------------+------+--------+-----------+-------+20 rows in set (0.13 sec)You can also execute SQL queries such as INSERT, SELECT, UPDATE, and DELETE. For example, supposeyou want to select all values residing in the Host, User, and password columns of the user table, found inthe mysql database, and order it by the Host:mysql>SELECT Host, User, password FROM user ORDER BY Host;In summary, you can execute any query via the mysql client that <strong>MySQL</strong> is capable ofunderstanding.■ Note <strong>MySQL</strong> treats query keywords in a case-insensitive fashion. For the sake of consistency, the keywords arecapitalized in this book. Keep in mind, however, that the default in Windows and OS X is to treat table names andfield names in a case-insensitive fashion, but in Unix they are indeed case sensitive.You can exit the mysql client by executing any of the following commands: quit, exit, \q, or Ctrl-D.Using mysql in Batch ModeThe mysql client also offers batch mode capabilities, used for both importing schemas and data into adatabase and piping output to another destination. For example, you can execute SQL commandsresiding in a text file by having the mysql client consume the contents of /path/to/file using the mysql [options] < /path/to/fileThis feature has many uses. For instance, one possible use of this feature is to send server statisticsvia e-mail to a system administrator each morning. For example, suppose that you want to monitor the508

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

Saved successfully!

Ooh no, something went wrong!