11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

www.it-ebooks.infoCHAPTER 27 • THE MANY MYSQL CLIENTSThis returns:+------------------+-------+| Variable_name | Value |+------------------+-------+| Bytes_sent | 11088 |+------------------+-------+1 row in set (0.00 sec)If you’d like to retrieve groups of similarly named variables (which often imply similar purpose), youcan use the % wildcard. For example, the following command would retrieve all of the variables used totrack statistics pertinent to <strong>MySQL</strong>’s query caching feature:mysql>SHOW STATUS LIKE "Qc%";Useful mysql OptionsLike all clients introduced in this chapter, mysql offers a number of useful options. Many of the mostimportant options are introduced here:• --auto-rehash: By default, mysql creates hashes of database, table, and column namesto facilitate auto-completion (you can auto-complete database, table, and columnnames with the Tab key). You can disable this behavior with --no-auto-rehash. If you’dlike to re-enable it, use this option. If you don’t plan to use auto-completion, considerdisabling this option, which will slightly speed startup time.• --column-names: By default, mysql includes the column names at the top of each resultset. You can disable them with --no-column-names. If you’d like to re-enable thisbehavior, use this option anew.• --compress, -C: Enables data compression when communicating between the clientand server.• --database=name, -D: Determines which database will be used. When using mysqlinteractively, you can also switch between databases as necessary with the USEcommand.• --default-character-set=character_set: Sets the character set.• --disable-tee: If you’ve enabled logging of all queries and the results with the option --tee or with the command tee, you can disable this behavior with this option.• --execute=query, -e query: Executes a query without having to actually enter the clientinterface. You can execute multiple queries with this option by separating each with asemicolon. Be sure to enclose the query in quotes so that the shell does notmisinterpret it as multiple arguments. For example:%>mysql -u root -p -e "USE corporate; SELECT * from product;"513

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

Saved successfully!

Ooh no, something went wrong!